Last active
December 25, 2015 06:49
Revisions
-
Erik Kronberg revised this gist
Oct 11, 2013 . 1 changed file with 14 additions and 0 deletions.There are no files selected for viewing
This file contains 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,3 +1,17 @@ /* Description: Write a function 'notQuine' which returns a string containing every ASCII character that is NOT part of the source code of the function. The outer 'function () { }' wrapper is included. A function containing all of the characters is not a valid solution. You may not modify Function.prototype.toString, notQuine.toString, String.indexOf, or String.fromCharCode. Only return characters from ASCII code 32 to 254. Order does not matter. */ var notQuine = function(){ var ascii = function () { var result = []; -
Erik Kronberg created this gist
Oct 11, 2013 .There are no files selected for viewing
This file contains 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,21 @@ var notQuine = function(){ var ascii = function () { var result = []; for (var i = 32; i < 255; i++) { result.push(i); } return result; }; var code = notQuine .toString() .split("") .map(function (c) { return c.charCodeAt(0); }); return ascii() .filter(function (c) { return code.indexOf(c) === -1; }) .map(function (c) { return String.fromCharCode(c); }) .join(""); };