const middleOfThree = (a, b, c) => (a + b + c) - (Math.min(a, b, c)) - (Math.max(a, b, c));
console.log(middleOfThree(5, 15, 20)) // 15
function middleOfThree(a, b, c) {
var array = [a, b, c];
array.sort((a, b) => a - b);
return array[1];
}
console.log(middleOfThree(5, 15, 18));
console.log(middleOfThree(20, 9, 31));
console.log(middleOfThree(20, 9, 12));
Console
15
20
12