JavaScript Number Object

Source: Internet
Author: User
Tags object numeric numeric value return string tostring wrapper

JavaScript Number Object
---------Number object is the wrapper object for the original numeric value.
Create a Number Object
var num = new number (10);
var num = number (10); ---parentheses are the values of the number object that you want to create or the value that is converted to numbers.
return value:
1. Returns a newly created number object when number () and operator new are used together as constructors
2, directly using number () as a function to call, it will convert its own parameters to the numeric value of an element, and return it (if the conversion fails, then return nan)

/* Below a simple example * *
Number (NULL)//0
Number (true)//1
Number (false)//0
Number (' 1 ')//1
Number (' a ')//nan
Number (undefined)//nan

Number Object Description
In JavaScript, a number is a basic type of data. JavaScript also supports the number object, which is the wrapper object for the original numeric value. When necessary, JavaScript automatically converts between raw data and objects.
Number Object method
ToString---Converts a number to a string, using the specified cardinality

/* Converts a Number object to a string and returns the result * *
Numberobject.tostring (Radix)
-----Radix Optional Parameters. A rule that represents the cardinality of a number, making an integer between 2~36. The default is 10.

Related Article

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

Starter Package

SSD Cloud server and data transfer for only $2.50 a month

Get Started >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.