Intermediate Javascript

I’m confuse I am studying Learn Intermediate Javascript right now. The lesson is Request fetch API. The lesson is using terms such us document.querySelector and JSON. I have no idea how this things work. Should I stop the intermediate course and learn first this JSON, query Selector and event listener?

If you haven’t already learned these things and the objective of the course isn’t to teach you these things, then I would definitely learn those things first.

To summarize though, document.querySelector() is a method on the document object. The document object comes from the Document Object Model (the DOM) which is a way of rendering and visualizing webpages. The querySelector() method searches the document object, which is the object at the top of the tree of all elements on a webpage, and returns the first object/element which has the CSS selector provided as its argument. As an example,

// JS:
const firstDiv = document.querySelector('first-div')

// HTML
<div class='first-div'>Hello world</div>

allows me to select that div and tie it to a variable. Then, I can manipulate it.

JSON is Javascript Object Notation and it is a way of serializing (translating) information between applications and parts of applications. It’s built on similar syntax to Javascript objects, hence the name.

{
    greeting: {
        message: "Hi, I'm a JSON object property.",
        author: "Me!"
    }
}

That’s a valid JSON file with a single object with various properties.

1 Like

Is the DOM course part of CSS? and how about JSON which course I need to take to learn this topic?

DOM and JSON are both somewhere in the Javascript courses.

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