Javascript Flashcards

1
Q

Es6

A
  1. Arrow functions
  2. Obj manipulation
  3. Spread operator
  4. Promises
  5. module import and export
  6. Let, const
  7. template literal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Var va let nad const

A

1.scope -var have global scope
Let and cons have blocked scope
Block lives in curly brackets.

  1. Hoisting- mechanism where variables and functions declarations are moved to the top of their scope before code execution

Let and const like var are hoisted to the top. Var are initialised as undefined , let and const will get reference error

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

Pure functions

A

Given the same input always return the same output

Has no side effects

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

Side effects

A

Is any application state change that is observable outside the called function other than return value

  • modding any external variable
  • Logging console
  • writing to the screen
  • tiggeing any external process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Imperative vs declarative

A

Imperative programs describing the specific steps used to get some results
Like for loop

Declarative- abstracts the flow control process, instead described the data flow, what to do.
Relying more on expression
Eg, map, reduce

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

What is a promise?

A

Promise is an object that may produce a single value some time in a future either resolved value or a reason that is not resolved
May be in 3 possible states: fulfilled, rejected, pending

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

What is the significance and what are benefits of including ‘use strict’?

A

Is a wY if voluntary enforce stricter parsing and error handling on your Javascript code at runtime. Code errors that would otherwise have been ignored or would have failed silently will now generate errors or throw exemptions

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