I am a newbie trying to understand the basics of Javascript with some basic exercises but I can't do this one. Any idea of how should I write it instead?
var array5 = [1,2,3,4,5];
for (var i=0; i<array5.length; i++) {
console.log(array5[i]);
if (array5===[2]) {
alert("we are in the middle of loop");}
}
PD: by the way, it has to be using the for loop and conditional if.
Thanks!