questions4 Flashcards

1
Q

What is strict mode in JS?

A

this is a mode that place some restrictions to your jS code for example it disables variable hoisting

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

What is the error in js?

A

Errors are statements that don’t let the program run properly. There 3 types : syntax errors, runtime errors, and logical errors

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

How to throw an error?

A

‘throw new Error’ syntax for errors with detailed information

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

How to handle an error?

A

try - wrap weird code that may throw an error in try block.
catch - catches an error
finally - code in the finally block will always be executed no matter is there an error.

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

How to work with the async error?

A

Promise has catch method it returns us the error from the failed async operation.

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

let and const, compare with var

A

var can be hoisted and it can be called outside of block scope.

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

Arrow functions

A

Arrow functions are always anonymous. ‘this’ refers to lexical/parent context

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

Template strings

A

string that gives more control over dynamic strings.
Template literal is created using the backtick () character scfss ${fff} ffvf`

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

Classes

A
Syntactical sugar. Classes are a template for creating objects. Class declarations are not hoisted.
Use class keyword to create a new class
Can be used with 'extends' keyword to make one class extended from another.
New keyword to create a new object based on class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Symbols

A
It is a primitive type in JS. 
Symbols are often used to add unique property keys to an object.
Every Symbol() call is guaranteed to return a unique Symbol
let sym2 = Symbol('foo')
How well did you know this?
1
Not at all
2
3
4
5
Perfectly