to integer in javascript code example
Example 1: Javascript string to int
var myInt = parseInt("10.256");
var myFloat = parseFloat("10.256");
Example 2: converst strig in number in js
const numberInString = "20";
console.log(typeof(numberInString))
const numInNum = parseInt(numberInString)
console.log(typeof(numInNum))
Example 3: javascript string to integer
<script language="JavaScript" type="text/javascript">
var a = "3.3445";
var c = parseInt(a);
alert(c);
</script>
Example 4: convert a string to number in javascript
var x = parseInt("1000", 10);