javascript string to integer
snippet in javascript

how to convert string to int js

user7460

let string = "1";
let num = parseInt(string);
//num will equal 1 as a int

javascript string to integer

user9744

var myInt = parseInt("10.256"); //10
var myFloat = parseFloat("10.256"); //10.256

javascript string to integer

user925

<script language="JavaScript" type="text/javascript"> 
var a = "3.3445";
var c = parseInt(a);
alert(c);
</script>