简单教程
提交运行
代码编辑器:
<p>myObject.fullName() 返回 John Doe</p> <script> var myObject = { firstName:"John", lastName: "Doe", fullName: function() { return this.firstName + " " + this.lastName; } } document.write(myObject.fullName()); </script>
运行结果: