DEV Community

[Comment from a deleted post]
Collapse
 
wahidibrahimy profile image
Wahid Ibrahimy

function getSecondLargest(nums) {
const max=Math.max(...nums);
return Math.max(...nums.filter(x=>x!==max))
}