find will return the element of the array, whatever you do in the callback function. Make sure the function returns true for the array element you want to find and false otherwise
I have redacted part of the code you shared in your post because it is considered to be sharing a solution with the original poster. We are trying to share tips/hints but not solutions when people post on the forum asking for help. Thanks for your understanding.
hey @ugwen i just wanted it to return the year when the result it’s “W”
The function should receive 1 argument, an Array of JavaScript Objects
Each object has two properties: year and result
It should use find() to test each Object to see if the result is "W" — a win!
It should return the year when the win occurred (if it occurred at all!)
If no win is found, it should return, sadly, undefined
find() only returns the first element it finds (looking in index order). so you need to use it on each element in case there are multiple elements that pass true.
sorry, didn’t take a look at problem/code, it is easier if you use ‘get help’ option which will automatically include code and link to exercise.