Answers for "javascript check if string ends with an element of an array of stirngs"

1

endswith()

var str = "Hello world, welcome to the universe.";
var n = str.endsWith("universe.");//returns true
Posted by: Guest on May-03-2020
0

how to compare a string with its ending in javascript

function solution(str, ending){
  return str.indexOf(ending, str.length - ending.length) !== -1;
}
Posted by: Guest on March-23-2020

Code answers related to "javascript check if string ends with an element of an array of stirngs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language