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");`
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");