HLJ 发布于
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-12-04/506.html
最后生成于 2023-08-04 21:38:32
此内容有帮助 ?
0