//是否为数组
let arr = [1, 2, 3];
console.log(typeof arr); // object
console.log(Array.isArray(arr)); // true
//数组去重
let array = [100, 23, 23, 23, 23, 67, 45];
let outputArray = Array.from(new Set(array));
//数字转字符串 / 字符串转数组
let num = 100;
let s = num.toString(); // 数字转字符串
let n = Number(s); // 字符串转数字
或
let s = num + ""; // 数字转字符串
let n = +s; // 字符串转数字
//数组转对象
let arr = ["value1", "value2","value3"];
let arrObject = {...arr};
/ 对象转数组
let numbers = { one: 1, two: 2, };
let key = Object.keys(numbers); // key = [ 'one', 'two' ]
let value = Object.values(numbers); // value = [ 1, 2 ]
let entry = Object.entries(numbers); // entry = [['one' : 1], ['two' : 2]]