Created
June 23, 2022 09:17
-
-
Save thedom85/9fcb3dfff4ebfce6da0ed58eac486a89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.codewars.com/kata/577a98a6ae28071780000989/train/javascript | |
var min = function(list){ | |
return list.reduce(function (p, v) { | |
return ( p < v ? p : v ); | |
}); | |
} | |
var max = function(list){ | |
return list.reduce(function (p, v) { | |
return ( p > v ? p : v ); | |
}); | |
} | |
console.log(min([-52, 56, 30, 29, -54, 0, -110]), -110); | |
console.log(min([42, 54, 65, 87, 0]), 0); | |
console.log(max([4,6,2,1,9,63,-134,566]), 566); | |
console.log(max([5]), 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment