Solution 1 can be simplified to:
function confirmEnding(str, target) {
return str.slice(-target.length) === target
}
If a negative number is provided as the first parameter to slice()
, the offset is taken backwards from the end of the string.
1 Like
Sky020
2
Hello there.
Thank you, for your contribution. For future contributions, please wrap your solution within :
[details]
```
code goes here...
```
[/details]
Also, provide all of the necessary code to pass the challenge.
Sky020
3
Thank you, for your guide post contribution. I have taken your suggestions and included them in the mentioned guide post.
We look forward to your further contribution.