<p dir="auto">Challenge <a href="https://www.freecodecamp.com/challenges/confirm-the-ending#?solution=%0Afunction%20confirmEnding(str%2C%20target)%20%7B%0A%20%20%2F%2F%20%22Never%20give%20up%20and%20good%20luck%20will%20find%20you.%22%0A%20%20%2F%2F%20--%20Falcor%0A%20%20if%20(str.endsWith(target))%7B%0A%20%20%20%20return%20true%3B%0A%20%20%7D%0A%20%20else%20return%20false%3B%0A%20%20return%20str%3B%0A%7D%0A%0AconfirmEnding(%22Bastian%22%2C%20%22n%22)%3B%0A" rel="nofollow">Confirm the Ending</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/53.0.2785.143 Chrome/53.0.2785.143 Safari/537.36</code>.<br>
Please describe how to reproduce this issue, and include links to screenshots if possible.</p>
<p dir="auto">My code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
function confirmEnding(str, target) {
  // &quot;Never give up and good luck will find you.&quot;
  // -- Falcor
  if (str.endsWith(target)){
    return true;
  }
  else return false;
  return str;
}

confirmEnding(&quot;Bastian&quot;, &quot;n&quot;);
"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">confirmEnding</span><span class="pl-kos">(</span><span class="pl-s1">str</span><span class="pl-kos">,</span> <span class="pl-s1">target</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-c">// "Never give up and good luck will find you."</span>
  <span class="pl-c">// -- Falcor</span>
  <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">str</span><span class="pl-kos">.</span><span class="pl-en">endsWith</span><span class="pl-kos">(</span><span class="pl-s1">target</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-c1">true</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
  <span class="pl-k">else</span> <span class="pl-k">return</span> <span class="pl-c1">false</span><span class="pl-kos">;</span>
  <span class="pl-k">return</span> <span class="pl-s1">str</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-en">confirmEnding</span><span class="pl-kos">(</span><span class="pl-s">"Bastian"</span><span class="pl-kos">,</span> <span class="pl-s">"n"</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function confirmEnding(str, target) {
  // &quot;Never give up and good luck will find you.&quot;
  // -- Falcor
  return str.endsWith(target) // if I don't end with semi-colon it will pass.
}

confirmEnding(&quot;Bastian&quot;, &quot;n&quot;);"><pre class="notranslate"><code class="notranslate">function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  return str.endsWith(target) // if I don't end with semi-colon it will pass.
}

confirmEnding("Bastian", "n");
</code></pre></div>