Below is the array:
largestNumber([1,19,[3,7],16,[19,27,12],13,11]);
I am trying to find the max value using Javascript function but not getting the solution.
Anyone could help me to get the solution.
Thanks in advance.
Below is the array:
largestNumber([1,19,[3,7],16,[19,27,12],13,11]);
I am trying to find the max value using Javascript function but not getting the solution.
Anyone could help me to get the solution.
Thanks in advance.
You can do this with Math.max
and spread syntax ...
const largestNumber = arr => Math.max(...[].concat(...arr));
console.log(largestNumber([1,19,[3,7],16,[19,27,12],13,11]))