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

Friday, May 12, 2017

FreeCodeCamp Confirm The Ending Sample Solution



function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  var diff = str.length - target.length;
  if(str.substring(diff,str.length) === target){
    return true;
  } else {
    return false;
  }
}

confirmEnding("Bastian", "n");

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts