10 interesting topics of JavaScript

Md. Miftahul Islam
2 min readMay 6, 2021

01. Data and Structure types:

JavaScript has six Data types that are primitives and three structural types are structural. The six primitive data types are:

● undefined: It shows when a variable doesn’t have any value.

● Boolean: It has two values. True and False.

● Number: It’s a primitive data type.

● String: It contains a sequence of characters.

● BigInt: It’s also a primitive data type. You can assign a numeric value beyond the value of the number’s limit by it.

● Symbol: It’s also a primitive value and can be used as the key of an Object property.

And the three structural types are:

● Object: It’s a structural type that stores collections of data.

● Function: It’s a kind of object. You can execute a block of code by calling a Function.

● null: It means the variable hasn’t any value.

02. Comments:

Programmers write comments in their codes. It makes code more understandable. Sometimes we programmers use comments to specify or to differentiate a part of code. But you shouldn’t use comments in every single line.

03. Error Handling:

Error is daily life’s partner of a programmer. You can’t avoid errors while coding. Most of the time it becomes a headache for us. A full project can stop if we can’t find and fix the errors. try…catch is used to handle errors in JavaScript.

04. Remove Code Repetition:

While coding, we repeat almost the same lines of code. It makes our code difficult to read. You can make functions to remove the recurrence of your codes.

05. Use const/let:

We use var, const and let to declare a variable. In ES6, const and let are used to declare variables. You can use const to declaring and assigning a value of your variable, which cannot change. And The use of let is the opposite of it. You can declare a variable by let when its value can be changed.

06. Default Function Parameter:

If you forget to set the value of a parameter, it will throw an error while calling the function. It’s better to set a default value of a parameter so that It doesn’t show any error.

07. Rest Parameter:

Rest parameter(…) helps us to take an infinity number of parameters as an array.

08. Spread Operator:

The Spread Operator is also written with(…). It copies all the elements of the selected array and pastes it into the new one. It saves the time of coding and makes your work much easy.

09. Destructuring:

With this method, you can destructure any array and object into individual values.

10. Arrow Function:

Arrow Function is just another method of declaring functions. It usually declares a function as a variable.

Thanks for reading my article.

--

--