let name = "Sam";Result is I am Sam and I am 45 years old.
let age = "45";
let str = `I am ${name} and I am ${age} years old.`
console.log(str);
Script write by ECMAScript 2015:
var name = "Sam";Remark: beware you must use the symbol `, not " or '
var age = "45";
var str = "I am ".concat(name, " and I am ").concat(age, " years old.");
console.log(str);
No comments :
Post a Comment