Applied JavaScript
June 15, 2019
Just completed my Lambda School sprint challenge, which brings closure to the Applied Javascript module!
I learned a lot over the past two weeks. The curriculum covered:
- The DOM and different DOM selectors
- Using different properties and methods to to manipulate selected elements
- How to create new elements, manipulate them and add them to the DOM
- Browser events, and adding event listeners and event handlers
- Recognizing event propagation and when/how to prevent it
- Components and identifying different parts of a component
- Creating custom data attributes with HTML and using them in CSS and JS
- How to utilize multiple classes to build components
The biggest difference between .forEach
and .map
is that .map
returns a newly created array while .forEach
doesn't return anything (both iterate through array values)
Closure is when a function is able to remember and access its lexical scope, even when executing outside of its lexical scope.
this
keyword rules:
- Object/Global: When in global scope,
this
is the window object - Implicit: When called in a method,
this
is the object to the immediate left of the . (dot) - Explicit: When a function is called with
.call
,.apply
or .bind
,this
is the object that's passed in as the first argument - New: When called in a constructor function,
this
is the newly created object
We use super()
in a class to call the parent's constructor function while abstracting away manually linking the parent's prototype to the child's prototype
The DOM, or Document Object Model, is the browser's representation of our HTML document. The structure is a tree of nodes we can interact with to manipulate the page.
An event is an action that takes place in the DOM. It could be triggered by user interactions (eg. clicks, scrolls) or generated by APIs.
An event listener is attached to a DOM element and listens for a specific event to occur, and then passes that event into the provided callback function.
A component is a reusable piece of code that can be used to build elements that share functionality and styling.
Next up is Build Week I'm looking forward to working on a project with other students!