Fundamentals
Arrays
Code
Diff
  • var thirdGreatest = (arr) => arr.sort((a,b) => b - a)[2];
  • 1
    var thirdGreatest = (arr) => arr.sort((a,b) => a - b)[arr.length - 3];
    
    1+
    var thirdGreatest = (arr) => arr.sort((a,b) => b - a)[2];