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 202 views
1 answer 230 views
1 answer 222 views
1 answer 217 views
1 answer 192 views
1 answer 202 views
...