JavaScript中的内置对象(2)

// 1547287516587 表示1970年1月1日距离现在所过去的毫秒

// 1547287516587 — >时间 new Date(時間戳)

// console.log(+date);

// 1. 时间戳就表示一个时间 是一个时间的数字的表示

// 2. 时间戳作用:计算两个时间的差

// 2.1 计算一段代码的执行时间

// date是开始的时间

// var start = new Date()

// var sum = 0;

// for(var i = 1; i <= 100000000; i++) {

// sum += i;

// }

// console.log(sum);

// // end是结束的时间

// var end = new Date();

// console.log(end - start);

// 2.2 倒计时

// 计算下载距离过年还有多久 过年那天: 2019年2月5日 0时 0分 0秒

var now = new Date();

var future = new Date(‘2019-02-05 00:00:00’);

// 距离过年还有的秒数

var time = parseInt((future - now)/1000);

// 1天

var day = parseInt(time/3600/24);

console.log(day);

// 小时 1小时 = 60分钟 = 3600

var hour = parseInt(time/3600) % 24;

console.log(hour);

// 分钟 = 60秒钟 只显示不足60的部分

var minute = parseInt(time / 60 ) % 60;

console.log(minute);

// 秒钟 不足60

var second = time % 60;

console.log(second);

document.write(‘

’);

document.write(‘距离过年还有:’+ day+‘天’ + hour + ‘小时’ + minute + ‘分钟’ + second + ‘秒钟’)

document.write(‘’);

四、Array对象


在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

Document Document Document Document Document Document Document Document Document Document Document

五、基本包装类型


在这里插入图片描述

Document

1.Number对象

在这里插入图片描述

Document

2.Boolean对象

在这里插入图片描述

Document

3.String对象

在这里插入图片描述

在这里插入图片描述

Document Document Document Document Document Document
  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值