questions4 Flashcards
What is strict mode in JS?
this is a mode that place some restrictions to your jS code for example it disables variable hoisting
What is the error in js?
Errors are statements that don’t let the program run properly. There 3 types : syntax errors, runtime errors, and logical errors
How to throw an error?
‘throw new Error’ syntax for errors with detailed information
How to handle an error?
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 to work with the async error?
Promise has catch method it returns us the error from the failed async operation.
let and const, compare with var
var can be hoisted and it can be called outside of block scope.
Arrow functions
Arrow functions are always anonymous. ‘this’ refers to lexical/parent context
Template strings
string that gives more control over dynamic strings.
Template literal is created using the backtick () character
scfss ${fff} ffvf`
Classes
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
Symbols
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')