Js Flashcards

1
Q

Var declaration

A

var’s declaration is hoisted not value

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

== vs ===

A

== value

=== value and type

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

Const

A

No reassignment of value

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

Window.

A

Base global object

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

I frame

A

Window on window

Access through window.frames

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

Document.

A

HTML that is loaded on the window

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

Undefined

A

Var has no value. JS sets the value to undefined

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

Prototype inheritance

A

Object -> property

Array.prototype.newMethod = ()=>

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

Function declaration vs expression

A

Declarations are hoisted

Expressions take variable scope

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

Promises

A

Set up an a sync data retrevial

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

shouldComponentUpdate

A

Triggered from external changes

Returns true or false
Args - (nextProps, nextState)

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

Using ref

A

Ref={input => this.inputElement = input}

componentDidMount() {
if (this.props.position ===0) {
this.inputElement.focus() }

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

shouldComponetUpdate

A

shouldComponetUpdate(nextProps, nextState) {

return nextProps.persons !== this.pros.persons

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

Redux

A

Global Store -> Reducer -> Action(mapDispatchToProps) -> Dispatch -> Component

Global Store -> Triggers -> Subscription -> Component

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

Why is typeOf bar === ‘object’ not a good check?

A

Because null is also an object. Should be
typeOf bar === ‘object’ && bar !== null

If bar should be an array an ES5 check would be:
Array.isArray(bar)

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

S in Solid

A

Single Responsibility Principle - class should have one and only one reason to change, meaning that a class should have one job

17
Q

O in Solid

A

Open Closed Principle - Objects should be open for extension, but closed for modification

18
Q

L in Solid

A

Liskov Substitution Principle - Every sub class should be substitutable for the super class

19
Q

I in Solid

A

Interface Segregation Principle - clients should be forced to depend on methods they do not use

20
Q

D in Solid

A

Dependency Inversion Principle - high level must not depend on low level they should depend on abstractions.

21
Q

Object.assign({}, {})

A

Clones object

ES6
{…state}

22
Q

Box Model

A

Wraps every HTML element (Margin, Border, Padding, Content)

23
Q

CSS Specitivity

A

Last In - First out
Class
ID
! Important

24
Q

.filter method
array = [1, 2, 3]
newArray = array.filter( i => i !==3)

What is returned

A

[1, 2]

25
Q

3 types React States

A

Local - show hide modal

Persistent - blog posts

Client - is auth