var x =parseInt("1000",10);// you want to use radix 10// so you get a decimal number even with a leading 0 and an old browser ([IE8, Firefox 20, Chrome 22 and older][1])
//string to number (typecasting)console.log(typeof("pp"))//Stringconsole.log(typeof(+"pp"))//Numberconsole.log((+"pp"))//Nanconsole.log(typeof(+""))//Numberconsole.log((+""))//0console.log(typeof(+"-6"))//Numberconsole.log((+"-6"))//-6// application of above conceptlet st=prompt("enter num")//Stringconsole.log(typeof(st))//${output entered in prompt box} let stnn=prompt("enter num")console.log(typeof(stnn))//Stringlet stnn =+stnn;//converting stnn variable as Numberconsole.log(typeof(stnn))//Numberconsole.log((stnn))//${output entered in prompt box}