Studying/coding test

라매개발자 프로그래머스 Lv0 풀기 # Day 1

코뿌 2023. 4. 18. 08:36

 

* 몫 구하기

: num1을  num2로 나눈 뒤 소수점을 버리면 몫이 나온다.

 

 

- parseInt 사용

 

- Math.floor() 사용하기

 

소수점을 버리고 싶을 때 Math.floor 대신 parseInt를 써도 될까?

 

parseInt 

: 문자열을 분석해서 정수를 반환한다. 

The parseInt() function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems). 

 

 

 

parseInt should not be used as a substitute for Math.trunc().