字符串转换为数组:
1 正则表达式var string=“abcdedef”var obj=string.replace(/(.)(?=[^$])/g,"$1,").split(","); //字符串转化为数组2 splitvar obj2 = string.split(""); //字符串转化为数组 数组转换为字符串var
a = [1,2,3];
a.join() a.join(‘,‘) a.join(‘|‘) a的类型被转换为字符串
时间: 2024-10-06 06:21:25
字符串转换为数组:
1 正则表达式var string=“abcdedef”var obj=string.replace(/(.)(?=[^$])/g,"$1,").split(","); //字符串转化为数组2 splitvar obj2 = string.split(""); //字符串转化为数组 数组转换为字符串var
a = [1,2,3];
a.join() a.join(‘,‘) a.join(‘|‘) a的类型被转换为字符串