魏
魏
``` function deepFlatten(arr) { return [ ...new Set( [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))) ) ]; } const result = deepFlatten([1, 2, 3, 4, [3, 4, [4, 6]]]); console.log(result);...
``` const shuffle = ([...arr]) => { let m = arr.length; while (m) { const i = Math.floor(Math.random() * m--); [arr[m], arr[i]] = [arr[i], arr[m]]; } return arr; }; const...
``` const getURLParameters = url => (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce( (a, v) => ( (a[v.slice(0, v.indexOf("="))] = v.slice(v.indexOf("=") + 1)), a ),{} ); getURLParameters(window.location.href) ```
I was thinking that `Map.size` should only concern itself with the length of the `key`, and it should be similar to `Map.keys`.
currently, only the return value of the clear method is different from the rules of Map and Set. ```javascript const readonlyMap = readonly(new Map()) console.log('size',readonlyMap.size) // 0 console.log('get',readonlyMap.get('key')) // undefined...
> I guess it could reduce a few characters (`, eventInfo`) in production mode, right? Yes, whether it is production mode or development mode, it can save a few characters...