日期对象
创建
var date = new Date()
2.方法
getFullyear() 获取当年
getMonth() 获取月(0-11)
getDate() 获取当天日期
getDay 获取星期几(星期日0到星期六6)
getHours() 获取小时
getMinutes 获取分钟
getSeconds() 获取秒
3.总毫秒数
(1)value of()
getTime()
(2)
var date = + new Date()
(3)h5新增
console.log(Date. now())
math对象
Math.PI 圆周率
Math. floor() 向下取整
Math. ceil() 向上取整
Math. round() 四舍五入,就近取整
Math. abs() 取绝对值
Math. max/ min () 最大值/最小值
随机数
Math. random()
此数在0到1之间
若想要这两个数之间的随机数且包含这两个数
function getrandom(min, max){
return Math. floor( Math. random()*( max-min)+ min;
}