toString():将数组的每个元素转换成为字符串,并依次连接起来,用逗号拼接并返回。
const arr = [1,22,33,'xyz',{age:21}];
const text = arr.toString();
console.log(text)//1,22,33,xyz,[object Object]
console.log(typeof text)//string
toLocaleString():将数组的每个元素转换成为字符串,并依次连接起来,用逗号拼接并返回。
const arr = [1,22,33,'xyz',{age:21}];
const text = arr.toLocaleString();
console.log(text)
console.log(typeof text)//string