创建自定义对象的最简单方式就是创建一个Object 的实例

2017-06-21 10:16:00
admin
原创
460
<!DOCTYPE html>
<html>
<head>
    <title>Creating Objects Example</title>
    <script type="text/javascript">
    
        var person = new Object();
        person.name = "Nicholas";
        person.age = 29;
        person.job = "Software Engineer";
        person.sayName = function(){
            alert(this.name);
        };
        
        person.sayName();

    </script>
</head>
<body>

</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络