ParseInt Syntax
Reference
parseInt(string, radix);
Parameters
string
The value to parse. If string is not a string, then
it is converted to a string (using the ToString abstract operation).
Leading whitespace in the string is ignored.
radix An integer between
2 and 36 that represents the radix (the base in mathematical numeral
systems) of the above mentioned string. Specify 10 for the decimal
numeral system commonly used by humans. Always specify this parameter
to eliminate reader confusion and to guarantee predictable behavior.
Different implementations produce different results when a radix is
not specified, usually defaulting the value to 10.
Do not do
var number = "09";
if(number == 09) { // here it will not compare the type check the == and ===
alert("OK: " + number)
} else {
alert("PROBLEM: " + number);
}
correct Answer
var number = "09";
var decimal = parseInt(number,10);
if(decimal === 09) {
alert("OK: " + decimal)
} else {
alert("PROBLEM: " + decimal);
}
Check this in console
var first = 10 ;
var secn = "10";
first == secn // true because both are equal.
first === secn // both are not equal by type(string and number)
var result = parseInt("010", 10) == 10; // Returns true
var result = parseInt("010") == 10; // Returns false
Number
The Number JavaScript object is a wrapper object allowing you to work
with numerical values. A Number object is created using the Number()
constructor. A primitive type object number is created using the
Number() function.
Example
Number('123') // 123
Number('12.3') // 12.3
Number('12.00') // 12
Number('123e-1') // 12.3
Number('') // 0
Number(null) // 0
Number('0x11') // 17
Number('0b11') // 3
Number('0o11') // 9
Number('foo') // NaN
Number('100a') // NaN
Number('-Infinity') //-Infinity

Image Reference