js dataType.constructor.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>js dataType.constructor</title>
</head>
<body>
<script>
    /*参考:
    * 1.dataType.constructor 属性返回变量或对象的构造函数。*/
    console.log("john".constructor);
    console.log((3.14).constructor);
    console.log(false.constructor);
    console.log([1, 2, 3, 4].constructor);
    console.log({name: 'john', age: 34}.constructor);
    console.log(new Date().constructor);
    console.log(function () { }.constructor);

    /*ƒ String() { [native code] }
    ƒ Number() { [native code] }
    ƒ Boolean() { [native code] }
    ƒ Array() { [native code] }
    ƒ Object() { [native code] }
    ƒ Date() { [native code] }
    ƒ Function() { [native code] }*/
</script>
</body>
</html>


发布了197 篇原创文章 · 获赞 61 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/weixin_42193179/article/details/105331058
今日推荐