My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Some of the terms which are asked in JS interviews quite often

Kritarth Sharma's photo
Kritarth Sharma
·Aug 1, 2021·

2 min read

Hoisting In JavaScript, Hoisting is the default behaviour of moving all the declarations at the top of the scope before code execution. Basically, it gives us an advantage that no matter where functions and variables are declared, they are moved to the top of their scope regardless of whether their scope is global or local.

Screenshot from 2021-08-01 20-36-16.png

The Window Object The window object is supported by all browsers. It represents the browser's window.

All global JavaScript objects, functions, and variables automatically become members of the window object.

Global variables are properties of the window object.

Global functions are methods of the window object.

Even the document object (of the HTML DOM) is a property of the window object:

window.document.getElementById("header");

is the same as:

document.getElementById("header");

window.open() - open a new window window.close() - close the current window window.moveTo() - move the current window window.resizeTo() - resize the current window

Difference between =,==,===

  • = is used for assigning values to a variable, == is used for comparing two variables, but it ignores the datatype of variable whereas === is used for comparing two variables, but this operator also checks datatype and compares two values.

  • = is called as assignment operator, == is called as comparison operator whereas It is also called as comparison operator.

  • = does not return true or false, == Return true only if the two operands are equal while === returns true only if both values and data types are the same for the two variables.