JS Fundamentals 1 Flashcards

1
Q

ECMAScript

A

JS standardization for browsers.
The “ES” in ES5, ES6, etc.
ES6 - 2015
Transpilers and Polyfills are used to help fill in browser limitations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

JS Runtime

A

Engine that interprets JS code.
Can be part of a browser, server, or other runtime env

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Single-Threaded Runtime

A

This is the Defining Feature of JS.
Runtime consists of a Stack and a Queue.
An Event Loop takes work from the Queue to the Stack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Shadow DOM

A

Creates a boundary around part of the UI that prevents a parent from changing a child.
It does this by forcing events started across the boundary to rescope their targets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Object Literal Notation

A

Declarative.
const bike = { gears: 10 }
Best for one-off objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

New Objects with Constructors

A

Best for creating 2 or more objects with the same properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

3 shapes of properties (on an object)

A

Primitives
Objects
Arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

6 Primitive types

A

String
Number
Boolean
Null
Undefined
Symbol (value guaranteed to be unique)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Prototype Inheritance

A

A prototype is an object that sits in memory and defines properties or functions.
Objects that share the same prototype inherit those properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Class-based Inheritance

A

JS does not have true class-based inheritance.
Constructor functions are syntactical sugar for Prototypal Inheritance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

DOM events / browser events relation to JS

A

DOM and browser events are not part of JS.
They are APIs implemented for JS in the browser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Runtime events path

A

Event is emitted in Runtime.
Message is created in the Engine.
Message placed in the Event Queue.
Once the Stack is free, the Event Handler is invoked, creating a Frame on the Call Stack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Function Declaration

A

A statement that uses the ‘function’ keyword to create a function.
These can be called BEFORE they are declared.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Function Expression

A

A function created with a variable.
These must be called AFTER they are declared.
const doubleUp = (num) => {}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Factory Function

A

A pattern where a function returns a function.
Useful for one-off reusable functions, especially to capture variable references in a closure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Hoisting

A

The use of ‘var’ does not recognize non-function blocks of code (such as ‘if’ statement or ‘for loop’), therefore its context is assigned to the nearest outer function (hoisting).

17
Q

Scope of let, const, var

A

let and const are block-scoped.
var is global or function-scoped (allows for hoisting).

18
Q

THIS

A

THIS is a pointer to the state of the current execution of code.
When a fn is invoked, there is always an object container around it (THIS).
Using the ‘new’ keyword for a constructor shifts THIS into the newly created object.

19
Q

Context

A

The object container of a function where it is invoked (not where it is declared)

20
Q

Closure

A

When functions are declared they can reference variables in the scope they are contained in, as well as those declared inside of or passed into the function.