How to concatenate a string with a variable in TypeScript

2 Answers

0 votes
const v = 'typescript';
const n = 45876;
  
const s = `lang: ${v} : ${n}`;
  
console.log(s); 
     
     
     
     
/*
run:
     
"lang: typescript : 45876" 
     
*/

 



answered Apr 23, 2022 by avibootz
0 votes
const v = 'typescript';
const n = 45876;
  
const s = "lang: " + v + " " + n;
  
console.log(s); 
     
     
     
     
/*
run:
     
"lang: typescript : 45876" 
     
*/

 



answered Apr 23, 2022 by avibootz

Related questions

1 answer 115 views
1 answer 149 views
1 answer 142 views
1 answer 137 views
1 answer 107 views
1 answer 128 views
...