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 420 views
1 answer 274 views
1 answer 246 views
3 answers 336 views
1 answer 273 views
...