Created
December 4, 2015 03:56
-
-
Save minsooshin/3166a8168c7822dc013d to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/minsooshin 's solution for Bonfire: Missing letters
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 characters
// Bonfire: Missing letters | |
// Author: @minsooshin | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-missing-letters | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function fearNotLetter(str) { | |
var start = str.charCodeAt(0); | |
var end = str.charCodeAt(str.length - 1); | |
var arr = []; | |
for (var i = start; i <= end; i++) { | |
if (str.indexOf(String.fromCharCode(i)) === -1) { | |
arr.push(String.fromCharCode(i)); | |
} | |
} | |
return arr.length ? arr.join('') : undefined; | |
} | |
fearNotLetter("abce"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment