Diff Two Arrays - true false seems to get backwards half way though code

Tell us what’s happening:
so decided to give the intermed algorhymins ago starting each by the first method that comes to mind after am looking at ways to improve them. this one i started with 2 forloops and check coniditons as below
seems to work then at one point arr1[i] (which is 3) = arr2[j] (again 3) = false obviously im missing something right infront of my eyes. spent a while looking at it really wish i wasnt having to ask. my code is far from finished i just wanted to get something to work for the first case before moving on and making it work for all the cases it needs to i really dont want anyone to post a full answer to the question please just want to know why 0 == 0 comes to true and then later in the pass 3 == 3 comes to false

Your code so far

function diffArray(arr1, arr2) {
  var newArr = [];
  for ( let i = 0 ; i < arr1.length ; i++){
    for ( let j = 0 ; j < arr2.length ; j++){

console.log("i",i,"j",j,arr1[i] === arr2[j]) 
              if (arr1[i] === arr2[j]){
                j = arr2.length
              } else if (arr1[i] !== arr2[j] && j === arr2.length-1){

  return newArr;

console.log(diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]));

i,0,j,0,true /// here 0 = 0 true 
i,1,j,1,true // here 1 = 1 true
i,2,j,2,true // here 2 = 2 
i,3,j,3,false // why does this change 2 false half way though the code

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0.

Link to the challenge:

Your console log is showing the value of I and j but you are comparing arr1[i] and arr2[j], so the check is actually 4 === 5 which is rightfully false
And if you notice with i being 3 and j being 4 it is true because the comparison is 5 === 5

Try with adding the arguments of this console log to yours: console.log("arr1[i]", arr1[i], "arr2[j]", arr2[j])

j = arr2.length // yeh dont do this

dont mess with your iterator

alkapwn3d, i was just using it to exit the nested for loop before the loop was used again it would be set back to 0 so i didnt feel like it would cause any issues

i ended up instead of using nested for loops as it was causing issues to get mutiple results into the newArr using 2 seprate for loops and indexOf to find the -1’s and push them seprately going to have a break and spend this eveing looking though methods and see if i can find a better way to write the code

thank you ieahleen your always saving me sometimes i think a second pair of eyes is needed, keep making stupid mistakes learning this isnt easy