javaScript 内部对象和时间

javaScript 内部对象

typeof 123;
"number"
typeof "123";
"string"
typeof true;
"boolean"
typeof [];
"object"
typeof {};
"object"
typeof undefined;
"undefined"
typeof liu.age;
"function"

时间

    <script>
        'use strict'

        function gettime() {
            let now = new Date();
            console.log(
                now.getFullYear(),//年月日时分秒
                now.getMonth(),//月  0-11月
                now.getDate(),//日
                now.getDay(),//星期几
                now.getHours(),//时
                now.getMinutes(),//分
                now.getSeconds(),//秒

                now.getTime(),//时间戳
                new Date(1651649375632),//时间戳转为标准时间写法
                now.toLocaleString()//本地时间
            )
        }
        
    </script>
posted @ 2022-05-04 15:11  小幼虫虫  阅读(19)  评论(0)    收藏  举报