Chunky Monkey : My Code Burst

Tell us what’s happening:
Hello everyone I want to know how my startin while loop going to break itself…
I had write this code but I myself not able to understand what is happening…Can anyone help?

Your code so far


function chunkArrayInGroups(arr, size) {
  // Break it up. 
  let len = arr.length;
  let newArr = [];
  let CompletePairForm=0;
  
  let i=0;
  while(i<len){
    let tempArr = [];
    let j=0;
    if(CompletePairForm<Math.floor(len/size)){
      console.log(i);
      while(j<size){
        tempArr.push(arr[i++]);
        j++;
      }
      CompletePairForm += 1;
      newArr.push(tempArr);
    }
    // else{
    //   break;
    // }
  }
  console.log(i);
  newArr.push(arr.slice(i,));  
  return newArr;
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)

Your browser information:

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

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

Your loop while(i<len){ will break when i is bigger or equal len.

You’re incrementing i by 1 in this line:

tempArr.push(arr[i++]);

Note that I did not check if your logic is correct and I don’t know if i will eventually be big enough to break the loop, especially because i is inside a if statement.