var massiv = [4; 5; 7; 3; 8; 2; 2; 2; 5; 9] How to find the position of the first occurrence of the number '2'?
var massiv = [4; 5; 7; 3; 8; 2; 2; 2; 5; 9] How to find the position of the first occurrence of the number '2'?
Decision:
massiv.indexOf(2) // вернет index More about indexOf can be found on the website: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
Source: https://ru.stackoverflow.com/questions/777457/
All Articles
massiv.indexOf(2);Well, in the array, the values separated by commas should be - Rostyslav Kuzmovych