Id in javascript

What is the meaning of What does it do? Please explain.

Can we get some context?

To me it looks like a property called “id” on an object called “output”.

1 Like

Hi @kevinSmith
const output = document.querySelector(‘.output’);
output.textContent = “Hello World”;
output.classList.add(“red”); = “tester”; = “red”;
output.textContent = document.URL;

So, in this context, output is an HTML element. So, = “tester”; is giving that HTML element an id.

1 Like

Thank you @kevinSmith.
Appreciate your response.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.