An Interest In:
Web News this Week
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
January 12, 2022 09:20 am GMT
Original Link: https://dev.to/codewithsnowbit/easiest-way-return-largest-numbers-in-arrays-daily-javascript-6-53ek
Easiest way return largest numbers in arrays - Daily JavaScript 6
Hello
,
It is very easy to do
function largestNumber(arr) { // You can do this! const largest = []; for (let i = 0; i < arr.length; i++) { largest.push(Math.max(...arr[i])); } return largest; } console.log(largestNumber([[105, 35, 63, 89], [130, 270, 128, 216], [312, 335, 357, 399], [1000, 1001, 857, 1]]))
This was a quick article, I hope it helped you
Thank you for reading, have a nice day!
- Follow me on Twitter - @codewithsnowbit
- Subscribe me on YouTube - Code With SnowBit
Original Link: https://dev.to/codewithsnowbit/easiest-way-return-largest-numbers-in-arrays-daily-javascript-6-53ek
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To