HEAD
Given an array of integers your solution should find the smallest integer. You can assume, for the purpose of this kata, that the supplied array will not be empty. For example:
Given [34, 15, 88, 2] your solution will return 2 Given [34, -345, -1, 100] your solution will return -345
class SmallestIntegerFinder {
findSmallestInt(args) {
let sortedArray = args.sort((a,b) => a-b)
return sortedArray[0]
}
}
Try it yourself - CodeWars
Given an array of integers your solution should find the smallest integer. You can assume, for the purpose of this kata, that the supplied array will not be empty. For example:
Given [34, 15, 88, 2] your solution will return 2 Given [34, -345, -1, 100] your solution will return -345
class SmallestIntegerFinder {
findSmallestInt(args) {
let sortedArray = args.sort((a,b) => a-b)
return sortedArray[0]
}
}
Try it yourself - CodeWars