toString of method analysis of Number objects in javascript

  • 2020-05-07 19:14:27
  • OfStack

This article illustrates the definition and use of the toString() method. Share with you for your reference. Specific analysis is as follows:

This method converts the Number object to a string and returns the string.

The syntax is as follows:

NumberObject.toString(radix)

parameter list:

参数 描述
radix 可选。规定表示数字的基数,使2 ~ 36 之间的整数。若省略该参数,则使用基数10。但是要注意,如果该参数是10以外的其他值,则ECMAScript标准允许实现返回任意值。

The instance code is as follows:

var a=new Number(3);
console.log(a.toString());

Output result :3.

I hope this article has been helpful to your javascript programming.


Related articles: