数组去重
const numbers = [1, 2, 3, 4, 4, 1]
console.log([...new Set(numbers)]) // [1, 2, 3, 4]
从数组中过滤所有虚值
const myArray = [1, undefined, null, 2, NaN, true, false, 3]
console.log(myArray.filter(Boolean)) // [1, 2, true, 3]
将字符串转换为数字
const str = '123'
const num = +str
console.log(typeof num) // number
将数字转换为字符串
const num = 123;
console.log(num + ''); // '123'