Converting string to number in javascript/jQuery

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

Been trying to convert the following to number:

9条回答
  •  离开以前
    2021-01-31 13:56

    You can adding a + before the string without using parseInt and parseFloat and radix, Simply

    sample:

    var votevalue = +$('button').data('votevalue');
    
    alert(typeof(votevalue));
    

提交回复
热议问题