Hello,
I’ve check the solution in the hint section, much shorter and cleaner than mind but I would still like to understand why what I’ve done doesn’t work …
When test with “Open sesame”, “same” it say false instead of true
Thanks a lot for your help 
function confirmEnding(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
var swap = []; //use to reverse the string
for (i = str.length; i >= 0; i--) {
swap.push(str[i]);
}
swap.shift();
swap = swap.join(""); //swap contain the reverse string "i checked"
var sizeoftarget = []; //to compare target with an identical length string
for (i = 0; i < target.length; i++) {
sizeoftarget[i] = swap[i];
}
sizeoftarget = sizeoftarget.join("");
if (target === sizeoftarget) {
return true;
}
else {
return false;
}
}
confirmEnding("Bastian", "name");
Ok here is what is wrong with your logic to solving this problem. If I am correct, your logic is basically reversing the given str and seeing if the beginning of the reversed str is equivalent to the target string that you are given. All the test cases that are supposed to result in false are completed for you because your logic isn’t properly checking for the correct cases which will give you true.
For the test case, confirmEnding("He has to give me a new name", "name")
, swap is equivalent to "eman wen a em evig ot sah eH"
and so “eman” !== “name”.
Hello,
Thanks a lot to both of you, I’m new so I didn’t knew I was supposed to create a new topic.
(can you explain how people see each new topic and answer so fast ? it’s really bluffing !)
Plus thanks to both of you I’ve understood that I also needed to reverse the target, I did and it work !
Thanks for helping me, I was running short on idea …
Another question by the way, I have no notification on my mail when I get an answer and I don’t have the reflex to loggin in the forum everytime (for an obsur reason, it’s not the same password so I have to log github to log the forum …). Do you know if it’s possible to activate an email alert or something like that ?
Thanks a lot <3
Thanks a lot I havn’t noticed 