question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

usage of .endsWith() in Confirm the Ending challenge

See original GitHub issue

Challenge 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:closed
  • Created 7 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
robbawebbacommented, Dec 28, 2016

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!

2reactions
robbawebbacommented, Dec 15, 2016

I’ll take this one up

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found