Created
January 11, 2021 16:50
-
-
Save FrozenIce0617/cf5be7d399c667b5a735ef19368745a5 to your computer and use it in GitHub Desktop.
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 groupArrayElements = ((arr, divideCnt) => { | |
const res = []; | |
const arraySize = arr.length; | |
const increment = Math.ceil(arraySize / divideCnt); | |
for (let i = 0; i < arraySize; i += increment) { | |
res.push(arr.slice(i, i + increment)); | |
} | |
return res; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment