usage of .endsWith() in Confirm the Ending challenge
See original GitHub issueChallenge Confirm the Ending has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.3.2883.75 Safari/537.36
.
In the context of the challenge, it is mentioned that we should not use the build-in “endsWith()” method, but when I used this method here, the problem actually got accepted, which contradicts the conditions given in the context. The test case at the last “Do not use the built-in method .endsWith() to solve the challenge.” also accepted this answer.
I confirmed this again after checking it after multiple refreshes in Google chrome and in Mozilla Firefox Developer Edition.
My code:
function confirmEnding(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
if (str.endsWith(target)){
return true;
}
return false;
}
confirmEnding("He has to give me a new name", "name");
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Two ways to confirm the ending of a String in JavaScript
Approach #2: Confirm the Ending of a String With Built-In Functions — with endsWith() ... For this solution, you'll use the String.prototype.
Read more >Two ways to confirm the ending of a String in JavaScript
Check if a string (first argument, str ) ends with the given target string (second argument, target ). This challenge can be solved...
Read more >CodeChallenge/Confirm the Ending.md at master
This challenge can be solved with the .endsWith() method, which was introduced in ES2015. But for the purpose of this challenge, we would...
Read more >Solving "Confirm the Ending" / FreeCodeCamp Algorithm ...
Check if a string (first argument, str ) ends with the given target string (second argument, target ). This challenge can be solved...
Read more >Confirm the Ending - freeCodeCamp Algorithm
Do not use the built-in method .endsWith() to solve the challenge. Psuedocode. // Create a function that accepts 2 strings, str and target ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just noticed that another issue was submitted 5 days ago about the same problem (#12198) and was closed because the changes were already added to staging with PR #10286, as I noticed and commented about earlier, so this issue could probably be closed as resolved in staging. Happy holidays and happy coding!
I’ll take this one up