Build a Confirm the Ending Tool - Build a Confirm the Ending Tool

Tell us what’s happening:

I have passed all other steps, but step 2 - “confirmEnding should take 2 parameters”.

Can anyone help? Is it me or is it something with the lab? I have looked at other examples and they have the parameters laid out the same as me.

Thank you :slight_smile:

Your code so far

function confirmEnding(string1,string2) {
  return string1.slice(-string2.length) == string2;
    }

let string1 = "Bastian";
let string2 = "n";
 
let result = confirmEnding(string1, string2);
console.log(result);

string1 = "Congratulation";
string2 = "on";
console.log(confirmEnding(string1, string2));

string1 = "Connor";
string2 = "n";
console.log(confirmEnding(string1, string2));

string1 = "Walking on water and developing software from a specification are easy if both are frozen";
string2 = "specification";
console.log(confirmEnding(string1, string2));

string1 = "He has to give me a new name"; 
string2 = "name";
console.log(confirmEnding(string1, string2));

string1 ="Open sesame";
string2 ="same";
console.log(confirmEnding(string1, string2));

string1 = "Open sesame";
string2 = "sage";
console.log(confirmEnding(string1, string2));

string1 = "Open sesame";
string2 = "game";
console.log(confirmEnding(string1, string2));

string1 = "If you want to save our world, you must hurry. We don't know how much longer we can withstand the nothing";
string2 = "mountain";
console.log(confirmEnding(string1, string2));

string1 = "Abstraction";
string2 = "action";
console.log(confirmEnding(string1, string2));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Build a Confirm the Ending Tool - Build a Confirm the Ending Tool

Your solution works from my end. Please try one of the following steps to move forward.

Click on the “Restart Step” button and force a refresh of your page with CTRL + F5 then try to paste the code in again.

or - Try the step in incognito or private mode.

or - Disable any/all extensions that interface with the freeCodeCamp website (such as Dark Mode, Ad Blockers, or Spellcheckers), and set your browser zoom level to 100%. Both of these factors can cause tests to fail erroneously.

or - Ensure your browser is up-to-date or try a different browser.

I hope one of these will work for you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.