Challenge Name
Confirm the Ending
Issue Description
Detailed Description:
FreeCodeCamp requires the camper to not use .endsWith() function to solve the given Basic Algorithm Scripting challenge in any way:
This challenge can be solved with the .endsWith() method, which was introduced in ES2015. But for the purpose of this challenge, we would like you to use one of the JavaScript substring methods instead.
However, a simple workaround can bypass this given test:
Do not use the built-in method .endsWith() to solve the challenge.
Workaround: Using if and else conditions to return true or false if the condition of str.endsWith(target) is satisfied.
Browser Information
- Browser Name, Version: Google Chrome Canary, 57.0.2960.0
- Operating System: OS X El Capitan (Version: 10.11.6)
- Mobile, Desktop, or Tablet: Macbook Pro 13' Retina (Early 2015)
Your Code
function confirmEnding(str, target) {
// #BUG: A workaround to bypass the limitation of not being able to use built-in function `.endsWith()`
if (str.endsWith(target)) {
return true;
} else {
return false;
}
}
confirmEnding("Bastian", "n");
^This code passes the challenge and uses the built-in method .endsWith(). If the code doesn't work, please click on Reset button and paste it again.
Screenshot

Challenge Name
Confirm the Ending
Issue Description
Detailed Description:
FreeCodeCamp requires the camper to not use
.endsWith()function to solve the given Basic Algorithm Scripting challenge in any way:However, a simple workaround can bypass this given test:
Workaround: Using
ifandelseconditions to returntrueorfalseif the condition ofstr.endsWith(target)is satisfied.Browser Information
Your Code
^This code passes the challenge and uses the built-in method
.endsWith(). If the code doesn't work, please click on Reset button and paste it again.Screenshot