function java script int code example
Example 1: javascript type casting int
Number("3.14") // returns 3.14
false.toString() // returns "false"
String(false) // returns "false"
Example 2: parseint function javascript
function convertToInterger(mystring) {
return parseInt(mystring);
}
console.log(convertToInterger("42"));