Confirm the ending-could you provide sources?

I am not sure it was. Only struggling you learn, if you don’t struggle you don’t learn-

eventually you will have to be able to do the challenge on your own
I suggest you return here in three days and try again to solve this challenge on your own.

this is one possible implementation from the steps I wrote above, you can look at what happens with pythontutor.

function confirmEnding(str, target) {
   let strLength = str.length;
   let targetLength = target.length;
   let indexToStart = strLength - targetLength;
   let endOfString = str.slice(indexToStart);
   let isItEqual = target === endOfString;
   return isItEqual;
}

confirmEnding("Bastian", "n");

also, please, when you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.

Yes, is true.
I dont feel good about it either I was very frustrated.
I will follow the steps you wrote above and do them on my own in three days on python tutor. I shall talk with you in three days time so Sunday.
I will follow the steps you wrote above with my own code.
How long did it take you to solve challenges on your own? I feel sad now so would be good to know if after 2 months is normal to struggle or dont remember which methods could help and how to apply them.
Thank you for mentoring me, it means a lot.
Karem

coding is hard, it is a completely new language that you have never heard before, with completely new syntax, new vocabulary, new rules.
And also, you are applying a seldom used skill: problem solving

To train both at the same time is really difficult, so you can try to train your problem solving skills taking algorithms and solving them this way as first thing:

just instructions in plain english (even the example above could contain too much code-slang), like a recipe, to go from the given input to the desired output

instead for the coding part, return to previous lessons, previous challenges, and try to do them again, even in different ways

example, here you have used

is there a different method that can do the same thing?

or, your return statements are return true and return false, can you instead reduce the code by returning an expression that evaluates to a boolean?

Thank you!
to simplify the code, returning an expression that evaluates to a boolean:
Would this be valid?

Inside the if statement:

var myResult = new Boolean()
return myResult.toString()

I checked this on MDN and I am not sure if this is the correct way to apply it.

no

a boolean is “true” or “false”
you would use an already existing expression in your code that already evaluates to a boolean

you are using an if statement, that evaluates the expression and based on if the expression is true or false it executes or it doesn’t execute

you can use that same expression on its own instead of inside the if statement, as it already evaluates to a boolean

Could you provide an example please?
It is a bit difficult to translate this into code in my head, thanks :slight_smile:

"return true if a is higher than b"

you could

if (a > b) {
   return true;
} else {
   return false;
}

but considering that a > b already evaluates to a boolean, this is the same:

return a > b;