toString()の引数に数字を入れると進数変換ができ文字列に変換します。 サンプルでは、10進数の数値を16進数、8進数、2進数に変換をしています。
JavaScript converts objects to primitive values by calling the valueOf method, and we rarely need to call the valueOf method ourselves. When an object with an expected primitive value is encountered, ...