Last active
August 29, 2015 14:23
Revisions
-
liushuping revised this gist
Jun 15, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,8 @@ default a key in the map. var x = {}; x["toString"]; // function toString() But with the Object.create method, we can create a real empty map object. What needed is just to pass null to the method. */ var map = Object.create(null); -
liushuping revised this gist
Jun 15, 2015 . 1 changed file with 5 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,13 @@ /* A JavaScript object notition is by nature a map, however there are limitations of it: the map is not empty, the Object prototype properties are mapped keys which are unexpected. For below example, the "toString" is by default a key in the map. var x = {}; x["toString"]; // function toString() But with the Object.create method, we can create a real empty map object. What needed is just to pass null to the method. */ var map = Object.create(null); console.log(map["toString"]); // undefined -
liushuping created this gist
Jun 15, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ /* A JavaScript object notition is by nature a map, however there are limitations of it: the map is not empty, the Object prototype properties are mapped keys which are unexpected. For below example, the "toString" is by default a key in the map. */ var x = {}; x["toString"]; // function toString() /* With the Object.create method, we can create a real empty map object. What needed is just to pass null to the method. */ var map = Object.create(null); console.log(map["toString"]); // undefined