js拼接字符串,字符串转数组
想要把字符串按一定的规则拼起来如 1,2,3
var a = [];
a.push(1);
a.push(2);
a.push(3);
a.join(',');
=>> 1,2,3
想要把'1,2,3' 转成字符串 ["1", "2", "3"] 字符串分割
var a = '1,2,3';
a.split(',')
=>> ["1", "2", "3"]
想要把字符串按一定的规则拼起来如 1,2,3
var a = [];
a.push(1);
a.push(2);
a.push(3);
a.join(',');
=>> 1,2,3
想要把'1,2,3' 转成字符串 ["1", "2", "3"] 字符串分割
var a = '1,2,3';
a.split(',')
=>> ["1", "2", "3"]