Hey Everyone!
So, I commented a couple of days ago that I was having some issues solving the Basic and Intermediate Algorithm questions. I went back and covered some information on array manipulation, loops, etc… I think I am grasping it, and instead of clicking for hints, I am spending a little more time getting creative as well as using mdn docs. With that being said here is my question. Previously I was worried about having an answer that would be accepted (example: shortest code, preferred method, etc…). But with getting more creative I don’t know if I am off the depend end with my answers or not.
Here is an example of what I mean using the Basic Algorithm Scripting: Return Largest Numbers in Arrays question.
This is what I have, and it works!
function largestOfFour(arr) {
var newArray = [];
for (var i = 0; i < arr.length; i++) {
var array = arr[i];
newArray.push(Math.max(...array));
}
return newArray;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
But this answer is not even one of the three levels when you click get a hint. Should I not be so creative, or is it more of a “Great Job, You didn’t look at the answers!!!”
Just want to make sure I have the right frame of reference for this!
Thanks for any feedback!