1parseInt(value);
2
3let string = "321"
4console.log(string); // "321" <= string
5
6let number = parseInt(string);
7console.log(number) // 321 <=int
1var myInt = parseInt("10.256"); //10
2var myFloat = parseFloat("10.256"); //10.256
1var text = '42px';
2var integer = parseInt(text, 10);
3// returns 42
4let myNumber = Number("5.25"); //5.25
1var myInt = parseInt("10.256"); //10
2var myFloat = parseFloat("10.256"); //10.256
1// parseInt
2parseInt("10");//------------ 10
3parseInt("10.00");//--------- 10
4parseInt("10.33")//--------- 10
5parseInt("34 45 66")//------ 34
6parseInt(" 60 ")//------ 60
7parseInt("40 years")//------ 40
8parseInt("He was 40")//----- NaN
9parseInt("10", 10)//-------- 10
10parseInt("010")//----------- 10
11parseInt("10", 8)//--------- 8
12parseInt("0x10")//---------- 16
13parseInt("10", 16)//-------- 16
14// parseFloat
15parseFloat("10")//-----------10
16parseFloat("10.00")//--------10
17parseFloat("10.33")//--------10.33
18parseFloat("34 45 66")//-----34
19parseFloat(" 60 ")//---------60
20parseFloat("40 years")//-----40
21parseFloat("He was 40");//----NaN
22/ mm.mirzaei /
1
2<script>
3 var v1 = parseInt("3.14");
4
5 document.write('Using parseInt("3.14") = '
6 + v1 + "<br>");
7</script>
8