Chunky Monkey-what's the value of 'newarr'

Chunky Monkey-what's the value of 'newarr'
0.0 0

#1

Tell us what’s happening:
I have no tool to get the value of ‘newarr’. Is there anyone who could tell me what ‘newarr’ will be in the end?

Your code so far


function chunkArrayInGroups(arr, size) {
  var newarr=[];
  var tmp=[];
  for(var i=0;i<arr.length-size;i+=size){
    tmp=arr.slice(i,i+size-1);
    newarr.push(tmp);
  }
  tmp=arr.slice(i,arr.length-1);
  newarr.push(tmp);
  return newarr;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey


#2

Put a console.log(newArr) in where you want to see the value of newArr in your code and then view your browser’s console (Ctrl+Shft+J in Chrome) to see the results. You may need to clear the console first and then run the tests so you only see the current tests’s results.


#3

Get it. Thank u very much!