Skip to main content

You can use the following. In this case of last character it's an overkill but for a substring, its useful:

`varvar word = "linto.yahoo.com.";`"; `varvar last = ".com.";`"; `ifif (word.substr(-(last.length)) == last)`  `alertalert("its a match");` ; 

You can use the following. In this case of last character it's an overkill but for a substring, its useful:

`var word = "linto.yahoo.com.";` `var last = ".com.";` `if (word.substr(-(last.length)) == last)`  `alert("its a match");`  

You can use the following. In this case of last character it's an overkill but for a substring, its useful:

var word = "linto.yahoo.com."; var last = ".com."; if (word.substr(-(last.length)) == last) alert("its a match"); 
added 6 characters in body
Source Link
Eray Balkanli
  • 8.1k
  • 13
  • 60
  • 94

You can use the following. In this case of last character it's an overkill but for a substring, its useful:
var word = "linto.yahoo.com."; var last = ".com."; if (word.substr(-(last.length)) == last)
alert("its a match");

`var word = "linto.yahoo.com.";` `var last = ".com.";` `if (word.substr(-(last.length)) == last)` `alert("its a match");` 

You can use the following. In this case of last character it's an overkill but for a substring, its useful:
var word = "linto.yahoo.com."; var last = ".com."; if (word.substr(-(last.length)) == last)
alert("its a match");

You can use the following. In this case of last character it's an overkill but for a substring, its useful:

`var word = "linto.yahoo.com.";` `var last = ".com.";` `if (word.substr(-(last.length)) == last)` `alert("its a match");` 
Source Link
Gauravsa
  • 6.6k
  • 2
  • 25
  • 33

You can use the following. In this case of last character it's an overkill but for a substring, its useful:
var word = "linto.yahoo.com."; var last = ".com."; if (word.substr(-(last.length)) == last)
alert("its a match");