본문 바로가기
부트캠프교육중/JavaScript

[JS] Math

by 뭉지야 2023. 8. 10.
728x90

Math.random()
-0부터 1사이의 숫자중 랜덤하게 나타난다.

Math.round(1.3)  // 1
-반올림

Math.ceil()
-올림

Math.floor()
-내림



Math.floor(Math.random() * 10)

Math.floor(Math.random() * arr.length)

728x90

'부트캠프교육중 > JavaScript' 카테고리의 다른 글

[JS] 노마드코더  (0) 2023.08.16
[JS] express  (0) 2023.08.11
[JS] new Date  (0) 2023.08.10
[JS] str.substr  (0) 2023.08.10
[JS] return  (0) 2023.08.06