Some Deep discussion of Javascript

Primitive Values: There are seven kinds of primitive values. The most use primitive value is number, string and boolean. Primitive values do not affect by doing code.

(a)Number: Number used for mathematical calculation.

(b)String: String is used to saying something in text form.

© Boolean: Boolean is used for an argument (true and false)

(d) Undefined: Undefined is an empty value, when something does not defines this will output as undefined.

(e) Null: Null is also an empty value.

(f) Symbol: A symbol is a built-in object whose constructor returns a symbol primitive.



conole.log(10) //numberconsole.log(“Alamgir”) //Stringconsole.log(null) //Null

Object & Function: Object and function also values but not primitive. Object and function values do affect by doing code.

(a)Object: Object is a collection of properties that store data as value.


var person = {firstName:”Alamgir”, lastName:”Hossain”, age:27};

(b)Function: Function is a procedure of output result after inputting any data. The function takes multiple parameters and it has a return statement. A function can call multiple times after defining it once.


function number(a, b, c, d) {///Execute code}

Event Loop: An event loop is a programming design pattern that works in the background and processes multiple works. The event loop creates a connection between callback Stack and callBack queue. Callback stack works by LIPO(last in first out), Callback queue works by FIFO(first in first out). It works to pass a value from the Callback queue to the Callback stack when the callback stack completes all synchronous functions.

Try… Catch: try, catch is a method of handling error. If something error in the code then it will execute a catch if there is no error then the catch will be ignored. If Catch does not define after try and if there have an error then hole code will crash. So it is important to use catch for handing error because when use catch and have an error in code then it will not crash but give result what error have a code. Try, catch work synchronously, it means if a function has setTimeout() function and if there have an error it will not catch the error. The build-in error has two main properties, one is a name and the other is a message. The name will give what type of error have and the message will show the text form of the full error.


try {// code…console.log(‘there is no error’)} catch (err) {console.log(err)}

Comment: Comment is used for details about how the code works. There are two types of comments. One is a good comment and the other is a bad comment.

Good Comment: Good comment is described very easily when the programmer thinks something will not understand by the user if that not mention. By good comments, a user can understand without looking back to code.


/*** Returns x raised to the n-th power.** @param {number} x The number to raise.* @param {number} n The power, must be a natural number.* @return {number} x raised to the n-th power.*/Function number(n) {}

Bad Comment: When a programmer explains what this code is, how it works, how to use and many explanatory things then it will call a bad comment.


// This code will do this thing (…) and that thing (…)// …and who knows what else…very;complex;code;

Arrow Function: Arrow function introduce in ES6. It allows defining function in a shorter format. If a function has one statement and returns a value then no need to return and {} bracket.


hello = () => “Hello World!”;hello = (str) => “Hello “ + str;

Function with Default Parameter Values: If a function is calling without a defined argument then it will result as undefined. If a function with default parameter value and not input any value when calling then it will show default value as result, and if give any value then that will show as result.


 function add(x, y = 2) {return x+y;}console.log(add(5)

The Spread Operator: The spread operator is used when all elements of an object or array need to include in a list.


function sum(a, b, c, d) {return a+b+c+d;}const numbers = [1,2,3,5,6];console.log(sum(…numbers));// expected output: 17




I'm a professional web- developer || JavaScript || React

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A Clean Approach to Using Express Validator

JWT based user Authentication using ReactJs, Node Express, and MySQL

Deep Dive Into Tree-Shaking

Learning CSS Animations with a touch of Javascript

How to create custom 404 error page in react js

Maintain a clean code based in React — Part 1

Cannot use import statement outside a module- NestJTypeORM TypeScript

Blog Article 05

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
Alamgir Hossain

Alamgir Hossain

I'm a professional web- developer || JavaScript || React

More from Medium

What is Dom:-

The Beginnings of Javascript Syntax

“==” vs “===” in JavaScript

Javascript Testing In a Nutshell