为了账号安全,请及时绑定邮箱和手机立即绑定

正在回答

1 回答

Number.prototype.toString ( [ radix ] )

NOTEThe optional radix should be an integer value in the inclusive range 2 to 36. If radix not present or is undefined the Number 10 is used as the value of radix.

The following steps are performed:

  1. Let x be thisNumberValue(this value).

  2. ReturnIfAbrupt(x).

  3. If radix is not present, let radixNumber be 10.

  4. Else if radix is undefined, let radixNumber be 10.

  5. Else let radixNumber be ToInteger(radix).

  6. ReturnIfAbrupt(radixNumber).

  7. If radixNumber < 2 or radixNumber > 36, throw a RangeError exception.

  8. If radixNumber = 10, return ToString(x).

  9. Return the String representation of this Number value using the radix specified by radixNumber. Letters a-z are used for digits with values 10 through 35. The precise algorithm is implementation-dependent, however the algorithm should be a generalization of that specified in 7.1.12.1.

The toString function is not generic; it throws a TypeError exception if its this value is not a Number or a Number object. Therefore, it cannot be transferred to other kinds of objects for use as a method.


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
node建站攻略(二期)——网站升级
  • 参与学习       51919    人
  • 解答问题       423    个

帮助你深入前后端开发留下的迷惑,为进一步自学打下基础

进入课程

Number.toString('hex')

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号