Write a JavaScript function that checks if a given string, ends with a given substring.
The input comes as 2 string arguments:
-
The first string will represent the main one
-
The second one will represent the substring.
Examples:
Input:
This sentence ends with fun?
fun?
Output:
true
Input:
This is Houston, we have…
We have…
Output:
false
Input:
The new iPhone has no headphones jack.
o headphones jack.
Output:
true
The output is either “true” or “false” based on the result of the check. The comparison is case-sensitive!