Why not looping all num?

Tell us what’s happening:
Describe your issue in detail here.

i’m trying to understand the double loop throughly , but i cant seem understand why i cant loop through 1 - 5.

i get the length is 0 - 4, but i couldnt get it how to get loop to the 5th.

function argu(arr1, arr2){
for(let i = 1; i < arr1.length; i++){
  for(let j = 1; j < arr2.length; j++){
    if(arr1){
      console.log(i, j);
    }
  }
 }
}

argu([1,2,3,4,5], [1,2,3,4,5])
   **Your code so far**

function destroyer(arr, ...arg) {
/*let arg = Object.values(arguments).slice(1)
console.log(arguments)
for(let i = 0; i < arr.length; i++){
  for(let j = 0; j < arg.length; j++){
    if(arr[i] === arg[j]){
      delete arr[i];
    }
  }
}

return arr.filter(x => x !== null)
*/
 /*let arg = [x]
  for(let i = 0; i < arr.length; i++){
  for(let j = 0; j < arg.length; j++){
    if(arr[i] === arg[j]){
      delete arr[i];
    }
  }
}
return arr*/
 
 for(let i = 0; i < arr.length; i++){
  for(let j = 0; j < arg.length; j++){
    if(arr[i] === arg[j]){
      console.log(i, j);
    }
  }
return arr

 }
}


console.log(
destroyer([1, 2, 3, 1, 2, 3], 2, 3));
   **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36

Challenge: Seek and Destroy

Link to the challenge:

I don’t really get what you’re trying to ask.

array index starts at zero.
array length starts at 1.
Thus the element at the end of array is always one less than the length: array[array.length - 1].
element 1 is at index 0.
if you start at 1, and array length is 5, your looping is only 5 - 1 = 4 times.

i get you. it seems the logic is correct. but if my goal is to have the 5 printed

i have to +1
for(let i = 0; i < arr1.length + 1; i++)

i just confused what if the question were to have [1,2,3,4,5] [5] and print with source [5] in the array.

something like that. just dont quite get why length cant reach to the end.

I don’t think you understand zero based indexing [0,1,2,3,4]

yes, i am. i tested wrong.

and…

now i get it. the log is not the result