javascript type casting int code example
Example 1: parseint javascript
var myInt = parseInt("10.256");
var myFloat = parseFloat("10.256");
Example 2: string to int javascript
var text = '42px';
var integer = parseInt(text, 10);
Example 3: javascript type casting int
Number("3.14")
false.toString()
String(false)
Example 4: string to int javascript
var text = '3.14someRandomStuff';
var pointNum = parseFloat(text);
Example 5: hex string to int javascript
console.log(hex.toString(16));
Example 6: convert a string to number in javascript
var x = parseInt("1000", 10);