How to interpolate variables in strings JavaScript

1 Answer

0 votes
const a = 3.14;
const b = "mathematical constant"

const s = `PI = ${a} ${b}`; 

console.log(s); 


  
     
     
     
/*
run:
     
"PI = 3.14 mathematical constant"
     
*/
 

 



answered Jun 4, 2021 by avibootz
...