Last active
August 29, 2015 14:05
Revisions
-
kotaroito renamed this gist
Aug 7, 2014 . 1 changed file with 0 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 @@ -1,4 +1,3 @@ var MyObject = (function() { function F() { this.keysStartWithLetterA = function () { -
kotaroito created this gist
Aug 7, 2014 .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,10 @@ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JS Bin</title> </head> <body> </body> </html> 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,19 @@ var MyObject = (function() { function F() { this.keysStartWithLetterA = function () { for (var key in this) { if ( key.substring(0,1) === "a" ) console.log(key); } }; } return function(proto) { F.prototype = proto; var f = new F(); return f; }; })(); var obj = MyObject({foo:1, a1: 1}); obj.keysStartWithLetterA();