Kata
Oh no, our Math object was “accidently” reset. Can you re-implement some of those functions? We can assure, that only non-negative numbers are passed as arguments. So you don’t have to consider things like undefined, null, NaN, negative numbers, strings and so on.
Here is a list of functions, we need:
Math.round()
Math.ceil()
Math.floor()
# My Solutions
1 | var _int, _float; |
# Others
parseInt, isInteger 메소드를 적절히 사용
1 | Math.floor = number => parseInt(number) |
# thoughts
- 간단한 건 직접 구현해보는 것도 좋은 공부
- MDN 폴리필도 꼭 한번씩 확인, 읽어보는 습관 갖기