Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Confirm the EndingPassed--Javascript

function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor

  let re = new RegExp(target + "$", "i");

  return re.test(str);
}

console.log(confirmEnding("Bastian", "n"));
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #Confirm
ADD COMMENT
Topic
Name
8+6 =