JavaScript Interview Questions & Answers
1. What is JavaScript?
JavaScript is a scripting language used to create and control dynamic website content, such as
interactive forms, animations, and more.
2. What are the data types in JavaScript?
JavaScript supports: String, Number, Boolean, Undefined, Null, Symbol, Object, and BigInt.
3. Difference between var, let, and const?
var: function-scoped, can be re-declared.
let: block-scoped, can't be re-declared.
const: block-scoped, constant value, can't be re-assigned.
4. What is the difference between == and ===?
== compares values after type conversion.
=== compares both value and type without conversion (strict equality).
5. What is an object in JavaScript?
An object is a collection of key-value pairs used to store multiple values in a single variable.
6. What are JavaScript functions?
Functions are blocks of code designed to perform particular tasks and are executed when invoked.
7. What is the DOM?
DOM (Document Object Model) is a programming interface that allows JavaScript to manipulate
HTML and CSS content.
8. What is an event in JavaScript?
An event is an action that occurs in the browser, like a click, hover, or keypress, and can be handled
using JavaScript.
9. What is a callback function?
A callback function is passed as an argument to another function and is executed after that function
completes.
10. What are arrow functions?
Arrow functions are a shorter syntax for writing functions: const add = (a, b) => a + b;