标签:log [] 方法 属性 script object function new html
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <script> var obj1 = new Object(); console.log(obj1); // var arr = []; //对象的字面量就是一个{};而里面的属性和方法是以:形式对应表现的。(键值对) var obj2 = {aaa:obj1,name:"张三","age":18,sayHi: function () { console.log(1); }}; console.log(obj2); obj2.sayHi(); </script> </body> </html>
标签:log [] 方法 属性 script object function new html
原文地址:http://www.cnblogs.com/sj1988/p/6579748.html