Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, May 13, 2017

FreeCodeCamp Missing Letters Sample Solution


function fearNotLetter(str) {
  var arr = str.split('');
  var codes = [];
  for(var i=0; i<arr.length; i++){
    codes.push(arr[i].charCodeAt(0));
  }
 
  for(var j=0; j<codes.length; j++){
    if(codes[j] != codes[0]+j){
      return String.fromCharCode(codes[0]+j);
    }
  }
  return undefined;
}

fearNotLetter("abce");

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts