Created
March 2, 2017 04:43
-
-
Save karanjamutahi/75d7ebece9fa1b21a6240a4576a4ac01 to your computer and use it in GitHub Desktop.
Trying out code for FCC
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
var test = ["a", "b", "c", "d","e","f","g","h","i","j"] ; | |
//console.log (test.length); | |
function chunkArrayInGroups(array,size){ | |
var newArray =[]; | |
for(i = 0;i<array.length;i+=size){ | |
var a = array.slice(i,size); | |
console.log(a); | |
console.log(i); | |
newArray.push(a); | |
console.log(newArray); | |
} | |
return newArray; | |
} | |
chunkArrayInGroups(test,3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment