Math对象和Date对象的方法

js中的对象
Math对象
Math.PI 圆周率
Math.random() 生成随机数
Math.floor() 向下取整
Math.ceil() 向上取整
Math.round() 四舍五入取整
Math.abs() 绝对值
Math.max() 最大值
Math.min() 最小值

Date对象
getFullYear() 获取年份
getMonth() 获取月份
getHours() 获取小时
getMinutes 获取分钟
getSeconds() 获取秒钟
getDate() 返回当月的第几天
getDay() 返回一个星期的第几天
toString() // 转换成字符串
valueOf() // 获取毫秒值

猜你喜欢

转载自blog.csdn.net/weixin_44387746/article/details/86015629
今日推荐