Last updated 4 years ago
Was this helpful?
sort by digits length as descending
return process-1's first element (which means most longest digit and first one)
const findLongest = (array) => array.sort((a, b) => String(b).length - String(a).length)[0];