scrimba
Note at 0:11
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Note at 0:11
Expand for more info
main.js
run
preview
console
function chunkyMonkey(values, size) {
// write code here.

const val = [];
let num = 0;

while( num < values.length) {
val.push(values.slice( num, num += size));
}

return val

}



/**
* Test Suite
*/
describe('chunkyMonkey()', () => {
it('returns largest positive integer possible for digit count', () => {
// arrange
const values = ["a", "b", "c", "d"];
const size = 2;

// act
const result = chunkyMonkey(values, size);

// log
console.log("result: ", result);

// assert
expect(result).toEqual([["a", "b"], ["c", "d"]]);
});
});
Console
"result: "
,
[
[
"a"
,
"b"
]
,
[
"c"
,
"d"
]
]
,
/index.html
LIVE