Iterating through document elements using for each in javascript 1

Iterating through document elements using for each in javascript

let a = document;	
let aArr = Array.from(a.all);
aArr.forEach(item => {
	console.log(item)
})

console.log(aArr)

Here is what the above code is Doing:
1. We’re creating a variable called a and assigning it to the document object.
2. We’re creating a variable called aArr and assigning it to an array of all the elements in the document.
3. We’re looping through the array and logging each item to the console.
4. We’re logging the array to the console.

The first three lines of code are the same as the code we wrote in the previous exercise.

The last line of code is new. We’re logging the array to the console.

When you run the code, you’ll see that the array is logged to the console.

The array contains all the elements in the document.

The first element in the array is the element.

The last element in the array is the