const getSumOfTwoSmallestNumbers = (numbers) => {
const sortedNumbers = numbers.sort((a, b) => a - b);
return sortedNumbers[0] + sortedNumbers[1];
}
I encountered this challenge on Code Wars. My function to find the sum of the two smallest numbers in an array is not passing one of the tests. I sorted the array first before trying to add the two smallest numbers. Any assistance would be greatly appreciated.