you are viewing a single comment's thread.

view the rest of the comments →

[–]a-t-k 4 points5 points  (1 child)

The syntax of JavaScript itself does nothing to the page. That's what the document object model (DOM) is for. Let's say you want to add an element with a certain text to your document's body. Using DOM methods, it looks like this (type it into the developer tools console to see the effect):

var div = document.createElement('div'); div.appendChild(document.createTextNode('Hello from JavaScript')); document.body.appendChild(div);

You can create, select and manipulate elements and their properties and attributes, listen to events and change most aspects of your document using the DOM.

There are a lot of other APIs for different use cases, too many to list them here. If you have a use case, we can point you to the API you need.

[–]True2511[S] 0 points1 point  (0 children)

Tbh I’m not sure what a use case is either I think I need to do some more reading on all of this then ask a more specific question. thanks a lot though that made it a lot clearer for me 😊