How to compare values while looping over multiple arrays simultaneously in javscript? [closed]

First off, I know this question has been asked before but it dosent seem to match my case.

I was a doing a coding assement and had a question like this:
enter image description here

I need to loop over two arrays simultaneously and compare their values to a number. I could not figure out how to do this.

  1. Is it possible to do this with for loops?

  2. Why was my code not hitting the 3 on the outer loop?

  3. What is the optimal solution considering time and space complexity?