Day 9 — ES6+ patterns
Lesson
Topic 1 Part 1
const address = `MI Road
Jaipur 302001
Rajasthan`;
Code below mirrors ../js/lesson.js. Open DevTools → Console to see output when the script runs.
Section 2 Part 2
console.log(address)
Code below mirrors ../js/lesson.js. Open DevTools → Console to see output when the script runs.
Section 3 Part 3
const address1 = `Mi road \n Jaipur 324324 \n Rajsthan`
console.log(address1)
Code below mirrors ../js/lesson.js. Open DevTools → Console to see output when the script runs.
Section 4 Part 4
const colors = ["red", "green", "blue"];
Code below mirrors ../js/lesson.js. Open DevTools → Console to see output when the script runs.
Section 5 Part 5
const [first, second, third] = colors;
console.log(first, second, third);
Code below mirrors ../js/lesson.js. Open DevTools → Console to see output when the script runs.
Section 6 Part 6
const showInfo = ({ name = "Guest", role = "User", city } = {}) =>
`${role}: ${name} : ${city}`;
console.log(showInfo());
console.log(showInfo({ name: "Riya", city : "xyz" }));
console.log(showInfo({city : "xyz"}))
Code below mirrors ../js/lesson.js. Open DevTools → Console to see output when the script runs.
Section 7 Part 7
console.log("--------------------------------------------------------------------------")
Code below mirrors ../js/lesson.js. Open DevTools → Console to see output when the script runs.