How to check if a string starts and ends with another string in Node.js

1 Answer

0 votes
const s = "node.js php c++ c node.js";
   
if (s.startsWith("node.js") && s.endsWith("node.js"))
    console.log("yes");
else
    console.log("no");


 
 

/*
run:
      
yes
      
*/

 



answered Jan 22, 2022 by avibootz

Related questions

...