In the code below an array of objects is given to the search() function. Change it so that the function returns the index of the element, that has the following properties: key name with the value of "John" and key age with the value of 30.
Array searching
Finding an object
Report a typo
Sample Input 1:
[{"name": "Ann", "age": 30}, {"name": "John", "age": 50}, {"name": "John", "age": 30}]Sample Output 1:
2Write a program in JavaScript
function search(objects) {
// 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.