• Image placeholder
  • 홈 페이지
  • 블로그 센터
  • 범주
Image placeholder

Math.ceil

Math 메서드로 랜덤하게 배열의 요소 가져오기

그 중 하나 많이 쓰는 것 Math.random() = 0에서 1 사이의 수를 가져온다. 0 에서 10 사이의 숫자가 필요하다면? Math.random() * 10 하면 된다. 하지만 소수점 자리도 필요가 없으니까 소수점 자리는 버려주는 몇가지 방법이 있다. 1. Math.round() 반올림해주는 메서드 1.1 ~ 1.4 = 1 로 반환 1.5 ~ 1.9 = 2 로 반환 2. Math.ce...

Math.roundmathMath.randomMath.floorMath.ceilMath.ceil

© 2022 intrepidgeeks.com

Privacy Policy Contact US Sitemap
🍪 This website uses cookies to ensure you get the best experience on our website. Learn more