The data type defines the type of data we are using in our program. Data Type tells the compiler or interpreter which data and how the user wants to use it in a program, making it easy to compile that data. Various data types vary according to various languages; the basic ones are Number, float, char etc.
Javascript is front end and back end web development language, and it provides various data types and wrapper classes. Number in javascript is a wrapper class used to convert any kind of data type in number format. Number() constructor is used for the conversion mechanism. When Number (value) in a program, it converts String or any other data type in Number format; if it isn't able to do it, then it returns NaN (Not a number).
The number Wrapper class contains various methods used to perform various operations on Number data.
Number(‘111’) // Return number 111
Number(‘111’)===111 // return true
Number (‘Knowledge2life’) // Return NaN
The wrapper class is very useful while coding for any website, there are various inputs and data of the user, which is a number, but the server gets in string format to change that format and perform an operation on it; Wrapper classes were used. Not only Numbers but also various Wrapper classes were used to convert the data format.
12300000
0.00123