更新时间:2022-06-14 21:20:33
var ArrayData = $.map($('#TheData').text().split(','), function(value){
return parseInt(value, 10);
// or return +value; which handles float values as well
});
您可以使用 $。map
进行转换通过在数组中的每个元素上调用 parseInt
来生成字符串数组
You can use $.map
to transform the array of strings to ints by calling parseInt
on each of the elements in the array