Basic_JavaScript_Interview_Questions_Answers
Basic_JavaScript_Interview_Questions_Answers
1. What is JavaScript?
JavaScript is a high-level, interpreted programming language used to make web pages interactive. It
is primarily used for client-side scripting, but can also be used on the server-side (Node.js).
undefined: A variable is declared but not assigned any value, or a function does not return a value.
Comparison Operators: ==, ===, !=, !==, >, <, >=, <=
`==` (Loose equality): Compares values after converting them to a common type.
`===` (Strict equality): Compares both values and types.
A closure is a function that retains access to its lexical scope, even when the function is executed
Event delegation is a technique where an event listener is attached to a parent element, and the
event is handled by checking the `event.target` to identify which child element triggered the event.
A function is a block of code that can be called to perform a task. It can be created using:
Hoisting is JavaScript's default behavior of moving declarations (but not initializations) to the top of
The `this` keyword refers to the context in which the current function is executed. Its value depends
The DOM is an interface that represents HTML and XML documents as a tree structure where each
Synchronous: The code is executed line-by-line, and each task must complete before the next one
begins.
Asynchronous: The code can execute tasks in parallel without blocking the next task.
A callback function is a function passed as an argument to another function that is executed later,