测试文章

let arr='1,2,3'.split(',') //将arr转化为以逗号分隔的数组
或 let arr2='123'.split('') 
//其结果都为["1", "2", "3"]

Array.from能将任何东西转化为数组
例:let arr=Array.from('abcdefg')
//打印出arr的值为["a", "b", "c", "d", "e", "f", "g"]
let arr='1,2,3'.split(',') //将arr转化为以逗号分隔的数组
或 let arr2='123'.split('') 
//其结果都为["1", "2", "3"]

Array.from能将任何东西转化为数组
例:let arr=Array.from('abcdefg')
//打印出arr的值为["a", "b", "c", "d", "e", "f", "g"]
let arr='1,2,3'.split(',') //将arr转化为以逗号分隔的数组
// 或
let arr2='123'.split('') 
//其结果都为["1", "2", "3"]

// Array.from能将任何东西转化为数组, 例:
let arr=Array.from('abcdefg')
//打印出arr的值为
["a", "b", "c", "d", "e", "f", "g"]

你可能感兴趣的:(测试文章)