Created
December 6, 2015 06:36
Revisions
-
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,26 @@ // Bonfire: Missing letters // Author: @dannycoder // Challenge: http://www.freecodecamp.com/challenges/bonfire-missing-letters# // Learn to Code at Free Code Camp (www.freecodecamp.com) function fearNotLetter(str) { //detect if the letter is missing if(str.length === (str.charCodeAt(str.length - 1) - str.charCodeAt(0) + 1 )){ return undefined; } else { //track down the missing letter for(var i = str.charCodeAt(0), j = 0; i <= str.charCodeAt(str.length -1); i++, j++) { //return the missing letter if(String.fromCharCode(str.charCodeAt(j)) !== String.fromCharCode(i)) { return String.fromCharCode(i); } } } } fearNotLetter("abce");