1、对之前学的js的核心组成中的ECMAscript的总结

js_内置对象Date Math 随笔 第1张

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

2、自己如何学习内置对象

js_内置对象Date Math 随笔 第2张

js_内置对象Date Math 随笔 第3张

3、内置对象---都是全局的

  1、Math对象

  js_内置对象Date Math 随笔 第4张

 

    案例1:

    Math.random()     ---生成随机数  [0,1)

    生成随机数 [10,20]

           js_内置对象Date Math 随笔 第5张

 

    案例2:

              js_内置对象Date Math 随笔 第6张

    2、Date对象

    a、Math对象和Date对象的区别

    js_内置对象Date Math 随笔 第7张

 

    js_内置对象Date Math 随笔 第8张

     b、日期构造函数的用法

    js_内置对象Date Math 随笔 第9张

    c、如何获取日期对象的毫秒值

    js_内置对象Date Math 随笔 第10张

    这里有个隐式转换  +  

    d、格式化日期

    js_内置对象Date Math 随笔 第11张

    所以要自己去做格式化:如下

    js_内置对象Date Math 随笔 第12张

     代码如下:判断参数是否是日期对象是比较严谨的做法。

    js_内置对象Date Math 随笔 第13张js_内置对象Date Math 随笔 第14张

    e、计算2个日期对象的时间差(可以用来做倒计时)

      js_内置对象Date Math 随笔 第15张

      js_内置对象Date Math 随笔 第16张

      js_内置对象Date Math 随笔 第17张js_内置对象Date Math 随笔 第18张

      js_内置对象Date Math 随笔 第19张

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄