JavaScript 字符串技巧
const list = "apples,bananas;cherries"
const fruits = list.split(/[,;]/)
console.log(fruits);
const num = 1
if (num === 1 || num === 2 || num === 3 || num === 4) {
console.log(num)
}
const nums = [ 1, 2, 3, 4 ]
const num = 1
if (nums.includes(num)) {
console.log(num)
}
const array = [ 1, [ 2, [ 3, [ 4, [ 5 ] ] ] ] ]
const flatAll = array.flat(Infinity)
const array = [ 1, 2, 3, 4, 5 ]
const lastEle = array.at(-1)
const ele1 = array.at(0)
const array = [ -1, 0, 10, 10, 20, 100 ]
const index1 = array.findIndex((num) => num < 0)
const index2 = array.findIndex((num) => num >= 10)