JavaScript (ES6) basic topic

JavaScript Error handling try……..catch

Samir Biswas
Nov 3, 2020

try statement lets test a block of code for errors.

catch statement lets handle the error.

When JavaScript code execute, there are different types of error can happen.

Errors due to wrong input or something, and other unnecessary things. Errors can be coding errors and it made by the programmer.

The try statement accepts that, define a block of code to be tested for errors while it is being executed.

The catch statement accepts that, define a block of code to be executed, if an error occurs in the try block.

JavaScript Declarations are Hoisted

A variable can be declared after it has been used.

In other words; a variable can be used before it has been declared.

Map, filter, find

The map() method creates a new array with the results of calling a function. It calls the provided function once for each element in an array. This method does not change the original array. map() method take 3 parameter (element, index, array).

This key word

this key word mention that which context is run that time.

const example = {name: “mimi”,func: function() {return this.name;},};console.log(example.func());// expected output: mimi

--

--