If you are in love with javascript, then you should know these 10 things.

  1. try…catch

Probably you faced errors during coding, isn’t it? And this is so annoying for every programmer. There are a couple of tricks to handle the code errors, try…catch is one of them. By using this syntax, you can handle your errors more effectively.

2. Variable Declaration and Hoisting

If you declare a variable before its initialization, it will occur undefined. As you can see in the image ‘a’ that the variable is initialized. That’s why the output is ok. But in the image ‘b’ , the variable is not initialized and the output is undefined.

3. var, let & const

Maybe you are a bit confused that which variable should I use, right? Well, you can use var or let whatever you but remember one thing that their value might be changed, and “let ” is generally used in block scope. on the other hand, ‘const’ is almost the same as ‘let’, but its value can’t be changed once it is declared. As it is said that the ‘const’ value is not changeable, so you should not use it in block scope.

4. Spread Operator

This operator helps you to add the previous array’s elements to your current array. It looks like this […]

5. Array function

It’s an ES6 feature. You can declare a function by using the ‘=>’ sign instead of using the word ‘function’. This is so cool, isn’t it? It will work the same.

6. Data Types

In javascript, there are two types of data. (i)Primitive (ii) And all the others are objects. Again, primitive has different types- (i)Number (ii)String (iii)Boolean (iv)Undefined (v)Null

7. map()

Map() is one of the most important methods used in javascript. Remember, you can not map an object. Besides, you can map an array inside an object.

8. comment

If you are a programmer, then you might be used the ‘comment’ system so often. It helps programmers a lot. For multi-line comments, you have to use the sign ‘//’. But for the single-line comment, you need to use the ‘/* */’ sign.

9. Concatenation

You might be get confused so often with this. Generally, it converts the operands from their actual type.

10. Anonymous function

The function without any name is called an anonymous function. Here is an example-

--

--

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