Camila Waz 发布于
2019-12-04 17:01:06

字符串转数组split()函数和数组转字符串join()函数实例

字符串转数组split()函数和数组转字符串join()函数实例
var string="abcdefg"
console.log(string.split(''));
// 输出结果:["a", "b", "c", "d", "e", "f", "g"]

var array=["a", "b", "c", "d", "e", "f", "g"];
console.log(array.join(','));
// 输出结果:a,b,c,d,e,f,g
当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2019-11-28/506.html
最后生成于 2020-03-24 14:26:59