Slice method question

hi guys,
console.log(str.slice(target.length)); lets take a look at this code, the result is asitan to my understanding, target length is 1, so it cuts the first (0) of bastian.

could you clarify me the process if I do console.log(str.slice(-target.length);
I understand it is the opposite but can’t figure out the process.
Your code so far

function confirmEnding(str, target) {

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/98.0.4758.82 Safari/537.36

Challenge: Confirm the Ending

Link to the challenge:

When in doubt, check MDN

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