JS Office Hour Question Answer
Asker: ArryPotta
Question
Hey, so I'm looking to get into frontend development, and I've been going through a bunch of courses... I am confident with my HTML, CSS, and basically half of Javascript. I always seem to get totally lost when they move into object oriented design. It's very frustrating because every learning resource I find seems to make this giant leap at this specific aspect of JS learning and starts speaking to you like you should already know half the things they're firing off at you. Did anyone else experience this while learning? How did you get past it? ... How do I use objects in webpages?!
Answer
- Divide and Conquer Split up what you want to learn into accessible pieces of knowledge you can study in a clear order.
- JavaScript Objects
- JavaScript Classes
- JavaScript Constructors
- JavaScript Events and the DOM
- JavaScript Templates
- JavaScript AJAX XHR
- JavaScript Objects Even easier JavaScript classes, there's JavaScript objects.
- JavaScript Classes OOP is not complex in its simplest form.
- JavaScript Constructors What is going on under the hood of JavaScript constructors?
- JavaScript Events and the DOM Tying OOP into HTML events and CSS manipulation is powerful, but it's an added layer of complexity. At the simplest level, you want an object to represent an element or component on your webpage. When the user interacts with that element, it will likely call a function on the object. The most common library used for this purpose is jQuery. A more robust and modern solution would be React.
- JavaScript Templates Another way objects are used in webpages is simple display. You have a webpage that represents and object. The various elements in that page display properties of that object.
- JavaScript AJAX XHR Yet another way objects are used in webpages is to wrap around requests made to an API.