What Is JavaScript?

Shongkor Talukdar
3 min readMay 10, 2021

JavaScript is the most popular web scripting language, used for both client-side and server-side development. Supporting object-oriented programming abilities, the JavaScript code can be inserted into HTML pages that can be understood and executed by web browsers.

Explanation of Scope in JavaScript.

Scope in JavaScript defines accessibility of variables, objects and functions.

There are two types of scope in JavaScript.

  1. Global scope
  2. Local scope

Global Scope:

Variables declared outside of any function become global variables. Global variables can be accessed and modified from any function.

Local Scope:

Variables declared inside any function with var keyword are called local variables. Local variables cannot be accessed or modified outside the function declaration.

What is the purpose of the ‘This’ Keyword in JavaScript?

The JavaScript ‘this’ keyword refers to the object it belongs to. This has different values depending on where it is used. In a method, this refers to the owner object and in a function, this refers to the global object.

What is HTTP request, Status code?

When we go to a restaurant and find our favorite to eat. We don’t know whether our favorite food have or not. In the website same thing happened. When we call for data we call in a promise, that response ok or not ok, that means we can get data or not this is called HTTP request.

In our browser in network tab different code is shown, when we get data it shows 200 (means ‘OK’); If our url is wrong then shows 404 (‘Not Found’) these code are the status code.

What is a closure in JavaScript?

A closure in javascript is a scope chain where the inner function has access to the variables of the outer function also has access to the global variable. It has three scopes to access variables one its own variable one is the variable of a function in which its wrap into and the other is the global variable.

Double equal vs triple equal:

The most important thing when we compare two values is equal or not equal this time we use == or ===. Both of them return a true or false value.

The basic difference between “==” checks only for equality of values but “===” used to check not only the equality of value but also its data types.

Truthy-falsy:

Except those values Everything is truthy value.

Closure in javascript:

The closure is by default behavior in Javascript. If we declare a function parentFunc() and inside this function we declare another function childFunc(). When we return the parentFunc() and then from childFunc() we can also access the parent function’s variable and object also. It’s happening for Closure in Javascript.

Event Bubble:

Event bubbling means when an event happens, it first runs the handlers on it, then on its parent then all other its ancestor. To stop event bubbling, use event.stopPropagation() method.

What is NaN?

NaN is a property that denotes a result that is not a number. It is a property of the global object. In other words, it is a variable in the global scope. The isNaN() is a function that determines whether a value is an illegal number or not. When the function finds a value of that condition it returns true, false otherwise.

--

--