jQuery练习t310,从0到1

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery-3.5.1.js"></script>
    <script>
        //检测操作
        //$.isPlainObject() 检测变量是否为原始对象
        $(function () {
           var person = {
               name : "tom",
               age: 5,
               hobby : "running"
           };
           document.writeln($.isPlainObject(person)); // true
            document.writeln("<br>");
            function Box(width, height) {
                this.width = width;
                this.height = height;
            }

            var box = new Box(100,100);
            document.writeln($.isPlainObject(box)); // false
            document.writeln("<br>");
            document.writeln($.isFunction(Box)); //true

            class Fox
            {
                constructor(width,height)
                {
                    this._width = width;
                    this._height = height;
                }
            }

            var fox1 = new Fox(100,100);
            document.writeln("<br>");
            document.writeln($.isPlainObject(fox1)); //false

        });

    </script>
</head>
<body>

</body>
</html>

猜你喜欢

转载自blog.csdn.net/modern358/article/details/113809981