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

1 Answer

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

 



answered Jan 22, 2022 by avibootz
...