1function endsWith(str, suffix) {
2 return str.indexOf(suffix, str.length - suffix.length) !== -1;
3}
4
5endsWith("hello young man","man");//true
6endsWith("hello young man","boy");//false
7
1function solution(str, ending){
2 return str.indexOf(ending, str.length - ending.length) !== -1;
3}