Generation

generate functionTue, 15 Nov 2022

sort a list and add the two largest numbers in the list.

Script function addLargestNumbers(lst){ lst.sort(); return lst[lst.length - 1] + lst[lst.length - 2]; } addLargestNumbers([1,5,6,2])

Want to kickstart your project?Use the new AI Studio to create your code