.slice & blank spaces

Tell us what’s happening:
Describe your issue in detail here.

Hello,
It’s been a very long time since I last worked on this so I was reviewing the solutions to remember the functions and I was confused whether .slice function in solution 1 counts blank spaces when indexing and determining where to cut the string. Any clarification would be greatly appreciated .

  **Your code so far**

function confirmEnding(str, target) {

else str = false;
return str;
}

confirmEnding("Bastian", "n");
  **Your browser information:**

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

Challenge: Confirm the Ending

Link to the challenge:

Yes, because blank spaces are characters. String.slice() would take all characters between starting index (inclusive) and ending index (exclusive).
Here is the MDN on String.prototype.slice()

1 Like

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