How to check if a string starts and ends with another string in TypeScript

1 Answer

0 votes
const s = "typescript php c++ c typescript";
   
if (s.startsWith("typescript") && s.endsWith("typescript"))
    console.log("yes");
else
    console.log("no");
  
 
 
 
     
/*
run:
      
"yes"
      
*/

 



answered Jan 22, 2022 by avibootz

Related questions

...