Find the smallest integer in the array : codewars javascript

front·2022년 11월 9일

kata

Given an array of integers your solution should find the smallest integer.

For example:

Given [34, 15, 88, 2] your solution will return 2
Given [34, -345, -1, 100] your solution will return -345
You can assume, for the purpose of this kata, that the supplied array will not be empty.

my answer

class SmallestIntegerFinder {
  findSmallestInt(args) {
    var num = Math.min(...args)
    return num;
  }
}

best answer

class SmallestIntegerFinder {
  findSmallestInt(args) {
    return Math.min(...args)
  }
}
profile
그냥 하기

0개의 댓글