# User FAQs

If you have a question, please send it to us.

1) Can you describe the 'number' data type ?
Double-precision, 64 bit binary format, IEEE 754 value.
They are all represented as floating point values.
The fraction is 52 bits, the exponent is 11 bits, and the sign is 1 bit.
The smallest value is 5 E -324
The largest value is 1.7976931348623157 E 308

`console.log( 3 + 2 + '6' );     // 56  `

2) Can you explain the difference between the global Number() function and the Number constructor ?
The Number() function can be used with primitive/literal values or with objects.
When used with literal values this function can be used to convert literal values to a 'number' data type.
If the literal value cannot be converted to a number, NaN is returned.

`let myLetNum1 = 10; let myLetNum2 = Number(10); console.log( typeof( myLetNum1) );         // 'number  console.log( typeof( myLetNum2) );         // 'number  console.log( typeof( Number('111 222') );  // 'NaN ?  `

When used with the 'new' keyword this function can be used as a constructor to create a Number object.

`let myLetNum3 = new Number(10); console.log( typeof( myLetNum3) );         // 'object  `

3) Can you list some Number properties ?
The Number data type also supports these special values.

`NaN - not a number indicator (added in ES 2015) POSITIVE_INFINITY - when a number exceeds 1.7976931348623157 E 308 NEGATIVE_INFINITY - when a number exceeds -1.7976931348623157 E 308 MIN_VALUE - the smallest positive numeric value MAX_VALUE - the largest positive numeric value MIN_SAFE_INTEGER - the smallest safe integer (-(2^53 - 1)). MAX_SAFE_INTEGER - the largest safe integer (2^53 - 1). `

4) Can you describe the 'NaN Property' ?

`console.log( typeof (Number.NaN) );         // 'number  console.log( Number.NaN === Number.NaN );   // 'false  `

5) Can you list some Number methods ?

`isFinite - isInteger - isNan - isSafeInteger - parseFloat - parses a string and returns a floating point number. parseInt - parses a string and returns an integer. toExponential - converts a number into an exponential notation toFixed - converts a number into a string, keeping only two decimals toLocaleString - formats a number to a string, using a specific locale toPrecision - formats a number into a specified length. toString - converts a number to a string valueOf - return the value from an expression `

6) When would you use the global isNan() function ?
This function returns true if the argument is not a number otherwise it returns false.
This function converts the argument to a number and then tests it.

`isNan(123)        // false isNan('text')     // true  isNan(undefined)  // true isNan(0/0)        // true `

7) Can you convert a 'number' data type to a 'string' data type ?
Yes. There are several ways this can be done.

`let myLetNum = 10; let myLetStr; myLetStr = myLetNum.toString();      // explicit myLetStr = String(myLetNum); myLetStr = `\${myLetNum}`;            // template strings myLetStr = '' + myLetNum;            // concatenate empty string  `

8) Can you convert a 'number' data type to a 'boolean' data type ?

9) What is 0.1 + 0.2 ?
This is not 0.3 but is actually 0.30000000000000004
When performing integer calculation the results are precise but this is not the case when working with fractions.
It is good practice to always truncate fractions to a fixed number of decimal places.

10) What is the parseInt() function used for ?
This Number method parses a string and returns an integer.

`let myLetNum = 100; myLetNum.parseInt('4F', 16);  `

11) What is the parseFloat() function used for ?
This Number method is used to parses a string and returns a floating point number.

`let myLetStr = ' 100 '; myLetNum.parseFloat(myLetStr); `

12) Can you list the arithmetic operators