This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
const chunkSize = 4 | |
const chunks = myArray.reduce((ar, it, i) => { | |
const ix = Math.floor(i / chunkSize) | |
if (!ar[ix]) ar[ix] = [] | |
ar[ix].push(it) | |
return ar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const $ = document.querySelector.bind(document) | |
// id | |
let divs = [ | |
$("#div"), | |
$("#input") | |
] | |
// class | |
let other = [ |