数组与字符串相互转换

/**
* 数组转字符串
*/
const arr = [1, 3, 5, 7, 9];
// 方法1
const str1 = arr.toString();
// str1:  1,3,5,7,9

// 方法2
const str2 = arr.join('**');
// str2:  1**3**5**7**9


/** * 字符串转数组 */ const str = 1**3**5**7**9; const arr = str.split('**'); // arr:[1, 3, 5, 7, 9]
原文地址:https://www.cnblogs.com/jing5990/p/15726483.html