Q1. What is JavaScript?
JavaScript is the most popular web programming language. JavaScript is a lightweight, interpreted programming language with object-oriented features that allows building interactivity into static HTML pages and is used for client-side and server-side development.
During the Initial days, JavaScript was a browser-only language, but now it can be executed on the server-side and client-side which has a JavaScript engine.
Q2. What is the difference between Java and JavaScript?
Sr. No. | Java | JavaScript |
1. | Java is an object-oriented programming language. | JavaScript is an object-based scripting language. |
2. | Java is a strongly typed language. In java type of variable is decided before declaring and using it. | JavaScript is considered a loosely typed language, so the user does not have to worry about the data type before the declaration. |
3. | Java code needs a compiler before it can be ready to run in real time. | JavaScript does not need compilation before running the application code. |
4. | Java is a stand-alone programming language. | JavaScript is not stand-alone, incorporated into an HTML program for operation. |
5. | Java is a slightly more complex language. | JavaScript is more straightforward in comparison. |
Q3. What are the features of JavaScript?
The following are the features of JavaScript:
- JavaScript is an open-source and cross-platform programming language.
- JavaScript is a lightweight, interpreted programming language.
- JavaScript supports object-oriented features.
- Integration with other frontend and backend technologies.
- Used especially for web and network applications.
Q4. What are data types supported in JavaScript?
The data types supported by JavaScript are:
- Undefined: Variables that are only declared and not defined and initialized.
- Null: Variables with empty and unknown values.
- Boolean: For storing true and false values.
- Number: For storing integer and floating-point values.
- String: For storing characters and alphanumeric values.
- Object: For collection and complex values.
- Symbol: For storing unique and anonymous values.
Q5. What is the difference between let and var?
Sr. No. | let | var |
1. | let is block scoped. | Var is function scoped. |
2. | let does not allow to redeclare variables. | Var allows redeclaring variables. |
3. | Hoisting does not occur in let. | Hoisting occurs in var. |
4. | let is ECMAScript 5 feature. | Var is ECMAScript 1 feature. |
Q6. What is a callback in JavaScript?
In JavaScript, functions are objects and that’s why we can pass a function as an argument to another function and a function can also be returned by a function.

A Callback is a JavaScript function that is passed to another function as a parameter or an argument. This function is to be executed when the function that it is passed gets executed.
Q7. What is the difference between function declaration and function expression?
Sr. No. | Function Declaration | Function Expression |
1. | In a function declaration, we declare the function using the function keyword. The function declaration must have a function name. | Function Expression is the same as function declaration without the function name. |
2. | Function declaration doesn’t require a variable assignment. | A function Expression can be stored in a variable assignment. |
3. | These are executed before any other code. | A Function expression load and execute only when the interpreter reaches the line of code. |
4. | Syntax: function recursiveMinds(parameter1, parameter2){//set of statements} | Syntax: var recursiveMinds = (parameter1, parameter2) => {//set of statements} |
Q8. What is the Arrow function in JavaScript?
In JavaScript, Arrow functions are used to write functions in short and concise syntax. Also, it doesn’t require a function keyword to declare a function. The arrow function can be omitted with curly braces {} when we have one line code.

Q9. Difference between “==” and “===” operators with example.
“==” is a comparison operator and it is used to compare values
“===” is also a comparison operator and it is used to compare values as well as their types.
Example:
var a = 10;
var b = “10”;
(a == b) // It returns true as the both values of a and b are same
(a === b) // It returns false as the type of a is number and type of b is string.
Q10. What is hoisting in JavaScript? Explain with an example.
In JavaScript, hoisting is a default process of moving the declaration of all variables and functions to the top of the scope. Hoisting allows functions to be safely used in code before they are declared.
Example:
Example 1:
recursiveMinds(); // “Recursive Minds” is an output that is declared as function even after it is called
function recursiveMinds(){
console.log(“Recursive Minds”);
}
Example 2:
recursiveMinds = 5;
console.log(recursiveMinds); // Output is 5 here variable is declared after it is initialized
var recursiveMinds;
Thank you for visiting Recursive Minds
Explore more questions from InterviewBit
Happy Coding