The given function receives an integer array. Return an index of the first element that has the value 3. If there is no such value, return -1.
Array iterating
Three
Report a typo
Sample Input 1:
[ 1, 2, 3 ]Sample Output 1:
2Sample Input 2:
[ 0, 3, 3, 2 ]Sample Output 2:
1Sample Input 3:
[ 1, 13, 4, 0 ]Sample Output 3:
-1Write a program in JavaScript
function three(arr) {
//write your code here
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.