Javascript / Browser Flashcards

1
Q

Context / this

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

EcmaScript

A

A specification for a general purpose scripting language to which Javascript conforms

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

Event bubbling

A

The propagation of an event from the target element to all elements up the DOM tree with an event listener of the same type

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

Event delegation

A

Using event bubbling by assigning an event handler to a parent element rather than all of its children

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

Event loop

A

The mechanism by which Javascript queues asynchronous functions until after all synchronous functions have executed, and then runs them

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

Hoisting

A

The placement of variable declarations (not assignments) at the top of their scope before code execution

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

Promise

A

An object that represents the eventual completion of some asynchronous operation

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

Prototype chain

A

The linked list of prototypes from any given object’s prototype up to Object.prototype and finally null

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

Prototypal inheritance

A

The way in which Javascript searches up the prototype chain to find properties or methods invoked but not defined on the calling object

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

Prototype

A

An object containing properties (including a reference to its own prototype) and methods accessible by all objects with that prototype

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

V8

A

Google’s Javascript engine; used in Chrome and Node

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

Browser cache

A

Data from frequently visited website that the browser stores on the client hard drive to improve performance

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

Cookie

A

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

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

localStorage

A

A web API for storing data in browser cache that persists indefinitely or until cleared

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

sessionStorage

A

A web API for storing data in browser cache that persists for the life of the tab

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

Critical render path

A

The process by which a browser renders a web page from code:

  1. HTML is parsed into the DOM tree; non blocking
  2. CSS is parsed into the CSSOM; blocking
  3. DOM and CSSOM are combined into the render tree
  4. Element layout is determined; re-occurs anytime the render tree is modified
  5. Pixels are painted on the screen; finished by Window.onLoad
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Document object model (DOM)

A

A browser generated model of an HTML document in nodes that can be manipulated with Javascript

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

CSS object model (CSSOM)

A

A browser generated model of CSS rules that is mapped onto the DOM

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

Render tree

A

The composite of the DOM and CSSOM made during the critical render path

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

Service worker

A

A program separate from the main Javascript file that enables offline functionality

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

Strict mode

A

A feature of ES5 that enforces a more restricted and safer subset of Javascript

22
Q

Primitive data types

A
  • Number (integers, floats, Infinity, -Infinity, NaN)
  • BigInt (integers > (2^53 - 1) or < -(2^53 - 1))
  • String (anything enclosed by quotes or backticks)
  • Boolean (true, false)
  • Null
  • Undefined (declared but unassigned)
  • Symbol (represents a unique identifier)

All primitives are immutable and assigned by value

23
Q

Number

A

A primitive data type encompassing integers, floats, Infinity, -Infinity, and NaN

24
Q

BigInt

A

A primitive data type encompassing integers > (2^53 - 1) or < -(2^53 - 1)

25
String
A primitive data type encompassing anything enclosed by quotes or backticks
26
Boolean
A primitive data that represents either true or false
27
Null
A primitive data type that represents an unknown or empty variable
28
Undefined
A primitive data type that represents an unassigned variable
29
||
The logical OR operator: - Returns the first truthy operand of an expression - If there are no truthy operands, it returns the last operand
30
&&
The logical AND operator: - Returns the first falsy operand of an expression - If there are no falsy operands, it returns the last operand
31
!
The logical NOT operator: - Returns the inverse boolean value of its operand
32
=
The assignment operator: - Assigns a value to a variable
33
==
The equality operator: - Returns true if both operands evaluate to the same boolean value, and false if not - If the operands are of different types they are converted to numbers before comparison
34
===
The strict equality operator: - Returns true if both operands are the same type and value - Doesn't attempt type conversion
35
%
The remainder operator: - Returns the remainder of dividing its first operand by its second
36
**
The exponentiation operator: - Returns the value of its first operand raised to the power of its second
37
Scope chain
The set of enclosing scopes Javascript will search to find variables used but not declared locally
38
...
The spread / rest operator: - When prefixed to an iterable, it destructures it into a list of individual items (spread) - When prefixed to the last parameter of a function, it collects the remaining arguments into a single array (rest)
39
Event capturing
The propagation of an event from the document to all elements down the DOM tree with an event listener of the same type; the inverse of event bubbling; happens before bubbling
40
New
The new operator; creates an instance from a supplied constructor function: - Creates an empty object - Adds a __proto__ property to the object that links to its constructor's prototype - Binds all references of 'this' in the constructor to the object - Implicitly returns 'this'
41
Let
Declares a block-scoped variable; can be reassigned but not redeclared; only initialized when parsed (either to undefined or the assigned value)
42
Var
Declares a global or function-scoped variable; can be reassigned and redeclared; initialized to undefined
43
Const
Declares a block-scoped, immutable variable; must be assigned at declaration; only initialized when parsed (either to undefined or the assigned value)
44
Continue
Jumps to the next iteration of the current loop
45
Break
Terminates the current loop
46
Switch...case
Evaluates an expression and executes the code whose case clause strictly matches
47
Try...catch...finally
Try marks a block of code to execute; catch marks a block of code to execute should an exception be thrown in try; finally marks a block of code to execute after catch, regardless of whether an error was thrown or not
48
Throw
Stops execution of the current function, generates an exception, and passes it to the nearest catch block; if there is no catch block the program terminates
49
Exception
Any value after 'throw'
50
Error
An object representing a runtime error; has name and message properties
51
Assign by value
When a variable stores its assigned value; used with primitives
52
Assign by reference
When a variable stores a reference (pointer) to the memory address of its assigned value; used with objects