Hamid
0
Q:

javascript endswith

"Hello world".endsWith("world");//true
"Hello world".endsWith("Hello");//false
5
var str = "Hello world, welcome to the universe.";
var n = str.endsWith("universe.");//returns true
2
function endsWith(str, suffix) {
    return str.indexOf(suffix, str.length - suffix.length) !== -1;
}

endsWith("hello young man","man");//true
endsWith("hello young man","boy");//false
1
function isJS(path) {
	return /jsx?$/.test(path)
}
0
function solution(str, ending){
  return str.indexOf(ending, str.length - ending.length) !== -1;
}
0

New to Communities?

Join the community