Theme
Primary Color
Lesson 6

Template Literals

محتوى الدرس

main.js
/*
  Template Literals [Template Strings]
*/

const theKind = "Male";

let oldWay = "Hello Its Me " + (theKind === "Male" ? "Mr" : "Mrs") + " Osama \n" +
"Iam " + theKind + " \n" +
"Iam From Elzero Web School \n" +
"I Love All My Followers";

let newWay = `Hello Its Me ${theKind === "Male" ? 'Mr' : 'Mrs'} Osama
Iam ${theKind}
Iam From Elzero Web School
I Love All My Followers`;

console.log(oldWay);
console.log(newWay);

// ################################

let username = "Osama",
    age = 36;

const myHtmlMarkup = `
  <div class="card">
    <h2 class="name">${username}</h2>
    <span class="age">${age}</span>
  </div>
`;

document.body.innerHTML = myHtmlMarkup;