创建过去七天的数组
[...Array(7).keys()].map(days => new Date(Date.now() - 24*60*60*1000 * days));
获取URL的查询参数
?foo=bar&baz=bing => {foo: bar, baz: bing}
let q = {}; location.search.replace(/([^?&=]+)=([^&]+)/g, (_, k, v) => q[k] = v); console.log(q);
数组去重
[...new Set(arr)]
创建特定大小数组
[...Array(3).keys()] // [0, 1, 2]