Discussion about the javaScript basic core concept and browser friendly that you must know

Nahidul Islam
5 min readNov 3, 2020
Photo by Shahadat Rahman on Unsplash

Types:

In JavaScript, six basic data forms are classified into three major groups. There is a primitive, composite, and special data type. Number, string, and boolean are primitive. Array, Object, and Function are composite, and finally Null and undefined are special data types. Without data type, a computer can not solve the problem.

a) Primitive Data type example (number, string, boolean) :

Boolean can hold only two values, it only checks whether true or false.

b) Composite Data type( Object, Array, Function) :

c) Special Data Types ( Null and Undefined ): Undefined and null are equal but they are different in type. Undefined used for unintentionally missing value on the other hand Null used for intentionally missing values.

Undefined and Null:

Undefined means, in JavaScript, that a variable has been declared but a value has not yet been allocated, such as:

So, that’s means undefined is to say that a variable has declared, but it has no value assigned and null represents an intentional absence of an object.

Call Stack:

A call stack is a data structure which records wherein the program is recorded. If we push something onto the stack when we call a function to execute, and we pop off the top of the stack when we return from a function.

When a program executes, all function is ignored first until it finds the printSquare(5) function invocation. Then added to the printSquare(5) function in the call stack list. After executing the program of all line inside the printSquare() function it gets to the multiply() function .so, it added this function in the call stack list then added square () function in the stack list. After executing a line of code inside of multiply()function, it invokes this function and continues the rest of the printSquare() function. After execute delete or pop the multiply() function from the call stack list. Similarly, execute the square() function then delete the square() function from the stack list. When everything is executed, then printSqure() function deletes from the call stack list. Finally, the stack list is empty.

Event Loop:

A continuously running mechanism that tracks both the callback queue and the call stack is the event loop. The event loop waits until it is empty and positions the next feature from the callback queue to the call stack if the call stack is not empty. Nothing occurs if the callback queue is empty.

Error Handling ( Try… Catch )

The code in try {…} is executed first.

If no errors have occurred, then catch(err) is ignored: the execution reaches the end of the attempt and continues by skipping catch.

If an error occurs, the execution of the attempt is stopped, and control flows to the beginning of the catch(err). An error object with details on what happened will contain the error variable (we can use any name for it).

Storing Data in Web Storage API:

A Web API is the dream of a developer —

a) It will expand the browser features

b) Complex functions can be greatly simplified.

c) For complicated code, it can provide a simple syntax.

There are two storage Local storage and session storage.

The local Storage object allows access to local storage for a particular web site. it has allowed you to store data, read, add, delete, modify the item. The advantage is local storage data has no expiration date, unless you delete the data or close the window tap.

On the other hand Session storage data allow you to for one session time, this data is deleted when windows are closed.

Cross Browser Testing:

Cross-browser testing is testing, that verifies or testing our development web application or site from a different browser and make sure that it works properly without any dependencies.

Step of cross-browser testing — -

Firstly test our website in our development machine from a different browser.

Secondly, if we look at structure are looking good, then test the functionality and responsive design so on.

Then check the larger device or pc and also try to the smaller device it properly responsive and other functions work smoothly.

After the application is a release for end users then try to beta testing performed and the bug can be fixed then solve the problem.

Finally, again test the website from multiple browsers and check functionality.

Hoisting:

Hoisting is a javascript default behavior of moving all the declarations at the top of the scop before code is executed. When function and variable are declared they moved to the top of the scope. A variable can be declared after it has been used. Here is the example is given below —

Here, we can access all three x,y,z variables before declaration as an undefined variable because of hoisting.

That's all today, Thank you for reading this blog, it might be a little bit helps all of us.

--

--

Nahidul Islam

AWS Certified Solutions Architect - Associate || DevOps Enthusiast || JavaScript Developer at SEBPO