string + number in javascript
snippet in javascript

Javascript string to int

user4315

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

string + number in javascript

user2625

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

javascript string to integer

user4329

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

string to int javacsript

user4967


 var a = parseInt("10");

 

javascript convert string to number

user3194

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

string to int javascript

user6659

var text = '42px';
var integer = parseInt(text, 10);
// returns 42