toString()
let arr = ["101", "202", "303", "505"];
let reslut = arr.toString();
console.log(reslut);
// 101,202,303,505
join()
join()
可以指定分隔符
- 默认
let arr = ["101", "202", "303", "505"];
let reslut = arr.join();
console.log(reslut);
// 101,202,303,505
- 指定分隔符,例如
&&
let arr = ["101", "202", "303", "505"];
let reslut = arr.join('&&');
console.log(reslut);
// 101&&202&&303&&505