Overview
All things in JavaScript are objects. JavaScript is an object-oriented language, but JavaScript does not use classes. In JavaScript, classes are not created and objects are not created through classes (as in other object-oriented languages). JavaScript is based on prototype, not class-based.
/** * Object Copy * http://www.cnblogs.com/yichengbo/archive/2014/07/10/3835882.html */function Testobjectclone () {debugger; var clone = function (source) {var result = {}; for (var key in source) {Result[key] = typeof Source[key] = = = ' object '? Deepcoyp (Source[key]): Source[key]; } return result; } var obj0 = {aaa: "AAA", BBB: "BBB"} var obj1 = Clone (obj0); OBJ1.AAA = "CCC";} /** * Map Type Implementation * http://www.cnblogs.com/superjt/archive/2012/12/21/2827742.html */function Testvirtualmapobject () {de Bugger; var mArr = {}; marr["A01"] = "AAA"; marr["A02"] = "BBB"; marr["A03"] = "CCC"; marr["A03"] = "DDD"; marr["A03"] = null; Delete marr["A03"]; Delete marr["A03"]; Marr.pop ("A03");} /** * Array type Object Test * http://www.w3school.com.cn/jsref/jsref_obj_array.asp */function testarrayobject () {debugger; var mArr = []; var str0 = "AAA"; var str1 = "BBB"; Marr[0] = STR0; MARR[1] = str1; Marr.push (STR1); Marr.pop ();} /** * Basic Object Type Test * http://www.w3school.com.cn/js/js_objects.asp */function testobject () {debugger; How to create an object var obj0 = {}; var obj1 = new Object (); Access Object Properties Obj0.property = "AAA"; Obj0.name = "BBB"; Console.log (Obj0.property); Console.log (obj0["property"]); Delete Object properties Delete obj0.name; Use Object Builder var person = new Person ("Wang", "999"); Traverse Object properties for (prop in person) {Console.log (prop); } console.log (Closeobj.getname ());} constructor functions function person (name, age) {this.name = name; This.age = age;} PrototypePerson.prototype.birthday; Person.prototype.address = "CCC"; Closure var closeobj = {name: "AAA", Getname:function () {return this.name; }};
Reference:
JavaScript objects
JS Object (Classic) Comprehensive
About adding, deleting, and modifying properties of objects to JavaScript objects
JS Object Type