javascript split string to array of int

后端 未结 5 1041
时光说笑
时光说笑 2020-12-09 07:33

I have a string that\'s on the page and from which I want an array of int.

2,3,0,43,23,53

I\'m writin

5条回答
  •  感情败类
    2020-12-09 08:10

    var ArrayData = $('#TheData').text().split(',').map(Number);
    

    You can find more here:

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map

提交回复
热议问题