massiv.forEach(function(item, i) { if (item == "1") { console.log(i); return false; } }); There is an array with values.
Inside the loop there is a condition for finding the value of the array.
Task: stop further iteration of the cycle at the first value found.
Thanks for the help.
Solution: (thanks to Lieutenant Jim Dangle)
[1, 2, 3, 4, 3].some(function(el,i) { if (el == 3) { console.log(i); return el; } });
someneeded only to check whether to stop passing through the collection or not. Therefore, if suddenly the desired element will be0- then in your case some will pass through the entire collection - Grundy