How to checks whether a string ends with specified character in JavaScript

1 Answer

0 votes
var s = "javascript c c++";

document.write(s.endsWith('t') + "<br />");
document.write(s.endsWith('+') + "<br />");

/*

run:

false
true

*/

 



answered Apr 10, 2017 by avibootz
...