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 258 views
1 answer 173 views
1 answer 147 views
3 answers 185 views
1 answer 173 views
...