var num = Math.random()*;
var num1 = Math.floor(num); // 向下取整
var num2 = Math.ceil(num); // 向上取整
document.write(num2+'-<br>');
document.write(num1); // 1-10 随机数
var a = Math.floor(Math.random()*+);
console.log(a); function selectForm(min,max){
var ta = max - min + ;
return Math.floor(Math.random() * ta + min);
}
console.log(selectForm(,)); var colors = ["red","gree","blue","yellow","black"];
var color = colors[selectForm(,colors.length-)];
console.log(color);
相关文章
- 11-21python之7-3对象的信息/方法获取
- 11-21js之for与forEach循环的区别
- 11-21eas之EntityViewInfo对象mainQuery中查询条件
- 11-21JS 面向对象 实现烟花特效
- 11-21JS之移除事件的兼容性处理
- 11-21修改 window.setTimeout,使之可以传递参数和对象参数
- 11-21JS创建对象的几种模式
- 11-21如何为JS对象添加getter和setter
- 11-21JS中控制对象的访问
- 11-21面向对象三大特征之封装