Converting string to number in javascript/jQuery

后端 未结 9 1902
攒了一身酷
攒了一身酷 2021-01-31 13:08

Been trying to convert the following to number:

9条回答
  •  暖寄归人
    2021-01-31 14:02

    var string = 123 (is string),

    parseInt(parameter is string);

    var string = '123';
    
    var int= parseInt(string );
    
    console.log(int);  //Output will be 123.
    

提交回复
热议问题