1. Functions default parameters: Functions with default parameters allow functions to use that value if that value is not passed in the parameters.

Example:

function addition(a, b = 2){

return a + b;

}

addition(1, 4) // 5

addition(5)

  1. Declaring objects using const:

A const declaration of object prevents modifications of the binding but not the value of the objects.Example:

const object = {

name: 'someone'

};

//work

object.name = 'new';

//throw error

object = {

name: "new"

}

  1. Const vs Let declaration:

let declaration:

The let declaration syntax is the same as var declaration syntax. let can be used instead of var. The difference between var and let is accessible only if it is declared. Unlike var it is not hoisted in the top of the functions.

const declaration:

Variables declared using const are considered constant.

const declarations are similar to let declarations. const variables are not accessible from outside of the block. but constant variables value can not be changed after assigning a value.

  1. Block-Level-Declaration:

Block level declarations are those that declare variables that are not accessible from outside of a block. It has two types of syntax when declaring a block: let and const. Block scope are created:

1.Inside of a function

2.Inside of a block

  1. Block-Bindings(ES6):

ECMAScript 6 has introduced block level binding to make variable declaration more easy in javascript. Traditionally, the way variable declarations work has been one tricky part of programming in JavaScript. When variables are declared using var, it is treated as a global variable. No matter where it is declared in a function it can be accessible from anywhere in that function. This is called Hoisting.

function(){

// x is accessible from here

if(condition){

var x = "value";

return x;

}else{

// x is accessible from here

return null;

}

// x is accessible from here

}

  1. Comments:

Comments are used in code to know how the code is working. It is really convenient for both users of the code and the coder himself. When a programmer comes back to his/her project after a while, comments help them why and how this code is written that way.

But its excess use can diminish code's cleanliness and readability. It is important to know when and how we use comments.

Comments have to be minimal and avoid using unnecessary comments.

  1. Try-Catch:

Errors are the most common phenomenon in programming and if you are a beginner then bless you. You know what I mean. An error can occur for many reasons like we programmers made a mistake or users put an invalid input and many more But you can handle an error with try-catch method.

When an error occurs a script dies meaning it will stop working and print it to console. It's totally not good for the user's experience. That's when try-catch comes into play.

try-catch allows us to catch that error without stopping the script.

The syntax of try-catch is:

try{

//code

}

catch(err) {

//error handling

}

  1. Javascript(Types of value):

avascripts has nine types of values. This values are divided into two main categories:

Primitive values:

Undefined

Null

String

Numbers

Booleans

Symbols

BigInts

Objects and Functions:

Objects

Functions

All the other fundamentals are called objects like: array, regular expression.The value's type of javascript can be checked using typeof() operator:

console.log(typeof(2)); //"number"

  1. Arrays:

Arrays are another type of object in javascript. Arrays are created in this manner:

let x = new Array();

x[0] = 1;

x[1] = 2;

x[2] = 3;

If an array is empty, the value of an array will be undefined. arrays are iterable using loops.