Some of the terms which are asked in JS interviews quite often
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.
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.