Learn some important things about javascript

Hi!, javascript lover. Today i will discuss some important things of javascript. First i will give some idea about error handling.

When the program runs and stops in the middle without running completely, it is called error problem. This can be due to various reasons. For example, if the server does not respond correctly due to a typo in the program, or if the user gives a wrong input, and error occurs in the program.

For example, As you coded 3 lines, if the code in line 2 in worng then the firest line of the program will run but the second line will be an error.

alert('hello world')


alert('hello javascript')

To get of this you need to know error handling.

So now we will get acquainted with some important blocks of error handling.

These 4 blocks are used more to get rid of the error ( try, catch, finally, throw)

* try: you have to put the main code inside the try

* catch: the error has to be handled inside the catch

* finally: the code inside the finally works all time

* throw: you can show any error message in the thorw



alert('hello world')


alert('hello js')




alert('hello js lover')


Now we learn about ES6 important things

ES6 means ECMAscript. It is name of update javascript. When javascript was update in 2016, it was named ECMAscript. ECMAscript short name ES6.

Es6 variable

Three type of varibales are used in ES6

1) let

* let keyworad is assaigned the block scope.

* let cannot be re-declared.

* let can be reassigned a value.

2) const

* It cannot be reassigned a value.

* It is block scoped.

* A constant cannot be re-declared.

3) var

* var can be re-declared.

* var can be reassigned a value.

ES6 variable scope

Two types of variables are used in ES6.

* Global scope: In the global scope, the variable can be accessed from any part of the javascript code.

var name = 'Hello world’;

function myfun(){




* Local scope: In the local scope, the variable can be accesed within a function where it is declared.


function myfun(){

var name ="Hello world";






Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store