Just want to talk about my code on Return Largest Numbers in Arrays (that’s the challenge link). My code here is this:
const largestOfFour = (arr) => {
return arr.map(num => Math.max(...num));
}
Code Explanation:
arr.map(num=>Math.max(...num));
- So this one-line return code that uses the
map()
function where it loops on the 4 arrays and then the constructor function num
would return the maximum value of the arrays.
It passed on the code testing but I’m just wondering if there’s a loophole in my code?
What do you mean excatly with loophole?
As far as I can figure it out you followed the instructions and the requirment are meet.
You can always check your code step by step here: http://pythontutor.com/visualize.html#mode=edit
1 Like
Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, if you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler]
and [/spoiler]
tags on the line above and below your solution code.
Thank you.