← Back to challenges

Check if String Ending Matches Second String

JavaScriptHardvalidationstrings

Instructions

Create a function that takes two strings and returns true if the first string ends with the second string; otherwise return false.

Examples

checkEnding("abc", "bc") ➞ true

checkEnding("abc", "d") ➞ false

checkEnding("samurai", "zi") ➞ false

checkEnding("feminine", "nine") ➞ true

checkEnding("convention", "tio") ➞ false

Notes

All test cases are valid one word strings.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Are the Numbers Equal?