Exercise on the for-of loop
Explore practical exercises using the for-of loop in JavaScript. Learn how to iterate through webpage headings to extract and concatenate characters, and generate sequences of emoji characters using Unicode code points. This lesson helps you understand iteration over iterable objects and Unicode handling with ES6 features.
We'll cover the following...
We'll cover the following...
Exercise 1:
Open the developer tools on any website. Locate the first character of all headings, and log the concatenation of the first characters.
Explanation:
The data from the headings can be obtained in several ways. The solution uses
document.querySelectorAll('h1', 'h2', 'h3', 'h4', 'h5', 'h6')
This query returns those 6 headings in ...