
JavaScript Essentials
Variables (let/const/var), types, closures, this, arrow functions, destructuring, spread/rest
1What is the main difference between let and var?
What is the main difference between let and var?
Answer
let declares a block-scoped variable, meaning it only exists within the block where it's defined (between braces). var has function scope, which can cause unexpected bugs as the variable is accessible throughout the entire function. Using let by default prevents hoisting issues and variable leaks in loops or conditionals.
2Which declaration to use for a value that won't change?
Which declaration to use for a value that won't change?
Answer
const allows declaring a constant whose reference cannot be reassigned. This improves code readability by clearly indicating intent and prevents accidental modifications. Note that for objects and arrays, const only prevents reassigning the reference, not modifying the content. It's the best practice for declaring immutable values.
3Which JavaScript data type is not primitive?
Which JavaScript data type is not primitive?
Answer
Objects are the only non-primitive type in JavaScript. Primitive types include string, number, boolean, null, undefined, symbol and bigint. Objects are stored by reference in memory, while primitives are stored by value. This means modifying an object affects all references to it, whereas copying a primitive creates an independent new value.
What does typeof null return in JavaScript?
What is the difference between == and ===?
+22 interview questions
Other React / Next.js interview topics
React Fundamentals
React Hooks
Component Lifecycle
React Router
State Management with Context
Forms & Controlled Components
Data Fetching & API
React Query (TanStack Query)
Styling & CSS-in-JS
Next.js Fundamentals
TypeScript with React
Next.js Data Fetching
Next.js Server Actions
Next.js Routing & Navigation
Next.js API Routes
Next.js Metadata & SEO
Next.js Middleware & Auth
React Testing
Zustand State Management
React Performance Optimization
Error Boundaries & Error Handling
Advanced React Patterns
Next.js Advanced Features
Next.js Deployment & Production
Architecture & Design Patterns
React Server Components
Next.js Internationalization
React Security & Best Practices
Master React / Next.js for your next interview
Access all questions, flashcards, technical tests, code review exercises and interview simulators.
Start for free