数组里的字符串转换成数字或者把数字转换成字符串
var arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9];arr1.map(String); //结果: ['1', '2', '3', '4', '5', '6', '7', '8', '9']var arr2 = ['1', '2', '3', '4', '5', '6', '7', '8', '9']arr2.map(Number); //结果:[1, 2, 3, 4, 5, 6, 7, 8, 9]
时间:2019-12-20 18:59:59
var arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9];arr1.map(String); //结果: ['1', '2', '3', '4', '5', '6', '7', '8', '9']var arr2 = ['1', '2', '3', '4', '5', '6', '7', '8', '9']arr2.map(Number); //结果:[1, 2, 3, 4, 5, 6, 7, 8, 9]
如何将数据库中text字段中返回的数据转换成数组的形式 并且将字符串的数字转换成数字
2022-05-02
Python将读取到的字符串文本数据转换成数字类型列表和数组
2021-04-15