convert string to number javascript
snippet in javascript

how to convert string to int js

user5286

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

Javascript string to int

user8026

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

convert string to number javascript

user7818

var myString = "869.99"
var myFloat = parseFloat(myString)
var myInt = parseInt(myString)

string + number in javascript

user7846

console.log(10+"1"); //101   both will be string
console.log(10-"1"); //9     string will be taken as number

javascript string to integer

user389

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

string to int javacsript

user6419


 var a = parseInt("10");