Create a function that returns the minimum of two numbers being given and in the case of at least four positive integers of the array. Positive integer or floating point number is not transmitted.

For example, when the transfer array like this [19, 5, 42, 2, 77], the output should be 7.

See more simple wording

function sumTwoSmallestNumbers(numbers) {
numbers.sort((a,b)=>{
return a-b;
})
return numbers[0] + numbers[1];
}

Guess you like

Origin www.cnblogs.com/1179929172-zh/p/12449577.html