Skip to content

Instantly share code, notes, and snippets.

@minsooshin
Created December 4, 2015 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minsooshin/3166a8168c7822dc013d to your computer and use it in GitHub Desktop.
Save minsooshin/3166a8168c7822dc013d to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/minsooshin 's solution for Bonfire: Missing letters
// 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