Wednesday, August 18, 2021

Strings and Template Literals in Javascript.

 Print Larger String in Javascript in Simple way look this-

const firstName = 'Anil';
const myJob = 'Programmer';
const myAge = 31;
const myDetails ='My Name is ' +' ' +firstName +' and my Job is ' +myJob +' My age is ' + myAge +' ' +'Years'; console.log(myDetails); 
Print Larger String Using Template Literals in Javascript Easy Way- I use backtick (``) instead of quotes which is present in your keyboard above TAB key. const firstName = 'Anil';
const myJob = 'Programmer';
const myAge = 31;
const myDetails = `My Name is ${firstName}, my Job is ${myJob} and my age is ${myAge} Years`;
console.log(myDetails);

0 comments

Post a Comment