Hi guys, I followed the instructions here to get an understanding of how to do this, but I’m failing one of the tests to pass the problem. The last array with all negatives is coming in as 0 not -3.
Do you see any issues? I noticed there are many ways to solve this and one is according to Google search Math.max(), but I wasn’t sure how to apply it so I just used the article (which gives a much better explanation than even the “hint”)
@ilenia I looked into it and saw that the Math.max solution wouldn’t be as helpful for me because I need more practice with for loops before I go into learning the other functions.
function largestOfFour(arr) {
return arr.map(Function.apply.bind(Math.max, null));
}
Not saying above would be the most complicated solution, but it seems for loops are more important to get down (based on my rookie observation).