Coding Challenge: String Ends With
I recently completed a coding challenge on CodeWars called “String Ends With.” The challenge required me to complete a solution that checks whether a given string ends with another specified string. The task was to return `true` if the first argument (string) passed in ends with the second argument (also a string).
## Problem Solving Approach
To solve the problem, I followed these steps:
Use endsWith method to check if the second parameter matches the last characters of the first string
Here’s the code snippet for the `stringEndsWith` function:
I also wrote unit tests using Jest to verify the correctness of the `stringEndsWith` function. These tests cover various scenarios, including cases where the string ends with the specified ending, cases where it does not end with the specified ending, and cases with non-string values.
Contact Information
Feel free to reach out to me on the following platforms: