Javascript / Browser Flashcards
Context / this
The object to which the executing function belongs:
- In global scope ‘this’ refers to the global object, Window in browser and Global in node; agnostic to strict mode
- In functions ‘this’ refers to the global object unless otherwise bound to another object; method style invocation (dot notation) implicitly binds ‘this’ to the calling object; defaults to undefined in strict mode
- In arrow functions ‘this’ refers to the ‘this’ of its lexical scope
EcmaScript
A specification for a general purpose scripting language to which Javascript conforms
Event bubbling
The propagation of an event from the target element to all elements up the DOM tree with an event listener of the same type
Event delegation
Using event bubbling by assigning an event handler to a parent element rather than all of its children
Event loop
The mechanism by which Javascript queues asynchronous functions until after all synchronous functions have executed, and then runs them
Hoisting
The placement of variable declarations (not assignments) at the top of their scope before code execution
Promise
An object that represents the eventual completion of some asynchronous operation
Prototype chain
The linked list of prototypes from any given object’s prototype up to Object.prototype and finally null
Prototypal inheritance
The way in which Javascript searches up the prototype chain to find properties or methods invoked but not defined on the calling object
Prototype
An object containing properties (including a reference to its own prototype) and methods accessible by all objects with that prototype
V8
Google’s Javascript engine; used in Chrome and Node
Browser cache
Data from frequently visited website that the browser stores on the client hard drive to improve performance
Cookie
A piece of data storing information about a user’s behavior / session; stored on the client and sent back to the server with each subsequent request; used for user analytics, preferences, and session management
localStorage
A web API for storing data in browser cache that persists indefinitely or until cleared
sessionStorage
A web API for storing data in browser cache that persists for the life of the tab
Critical render path
The process by which a browser renders a web page from code:
- HTML is parsed into the DOM tree; non blocking
- CSS is parsed into the CSSOM; blocking
- DOM and CSSOM are combined into the render tree
- Element layout is determined; re-occurs anytime the render tree is modified
- Pixels are painted on the screen; finished by Window.onLoad
Document object model (DOM)
A browser generated model of an HTML document in nodes that can be manipulated with Javascript
CSS object model (CSSOM)
A browser generated model of CSS rules that is mapped onto the DOM
Render tree
The composite of the DOM and CSSOM made during the critical render path
Service worker
A program separate from the main Javascript file that enables offline functionality