Math()对象

2/18/2022 JavaScript

# Math.floor()

# Math.ceil()

# Math.random()

# 写一个概率为1/2的函数

let randomSuccess = () => {
 let num = Math.random();
 if (num < .5 ){
   return true;
 } else {
   return false;
 }
};
1
2
3
4
5
6
7
8
Last Updated: 5/2/2022, 9:10:03 AM