// 数组转字符串,用逗号间隔 let list=['aaa'] console.log(list.join(',')) list=['aaa','bbb','ccc'] console.log(list.join(',')) // 字符串转数组,用逗号间隔 let str='aaa' console.log(str.split(',')) str='aaa,bbb,ccc' console.log(str.split(','))
输出:
aaa aaa,bbb,ccc ["aaa"] ["aaa", "bbb", "ccc"]