How to check whether a string ends with another string in JavaScript

1 Answer

0 votes
var s = "javascript php c++";
 
if (s.endsWith("c++"))
    document.write("yes");
else
    document.write("no");

   
   
/*
run:
    
yes 
    
*/

 



answered Nov 22, 2019 by avibootz

Related questions

3 answers 244 views
1 answer 162 views
1 answer 139 views
3 answers 176 views
1 answer 168 views
...