1var myInt = parseInt("10.256"); //10
2var myFloat = parseFloat("10.256"); //10.256
1parseInt(string, radix);
2
3console.log(parseInt(' 0xF', 16));
4// expected output: 1500
5
6console.log(parseInt('321', 2));
7// expected output: 0
8
9console.log(parseInt('321', 10));
10// expected output: 321
11
12/*
13 * @param string Required. The value to parse. If this argument is not
14 * a string, then it is converted to one using the ToString abstract
15 * operation. Leading whitespace in this argument is ignored.
16 *
17 * radix
18 * @param radix Optional. An integer between 2 and 36 that represents
19 * the radix (the base in mathematical numeral systems) of the string.
20 * Be careful—this does not default to 10!
21 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt#Description
22 * for what happens when radix is not provided
23 */