Flashcards · JavaScript · Free
JavaScript flashcards, generated for you.
Example JavaScript study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example JavaScript flashcards
What are the three ways to declare a variable in JavaScript?
var (function-scoped, hoisted), let (block-scoped, temporal dead zone), and const (block-scoped, cannot be reassigned). Use const by default, let when you need to reassign, avoid var in modern code.
What is the difference between == and === in JavaScript?
== performs type coercion (e.g., '5' == 5 is true), while === checks both value and type without coercion (e.g., '5' === 5 is false). Always use === to avoid unexpected behavior.
What does 'hoisting' mean in JavaScript?
Hoisting moves variable and function declarations to the top of their scope during compilation. var declarations are hoisted and initialized as undefined; let/const are hoisted but not initialized (temporal dead zone); function declarations are fully hoisted.
What is the difference between null and undefined?
undefined means a variable has been declared but not assigned a value, or a function has no return statement. null is an explicit assignment meaning 'no value' and represents intentional absence. typeof undefined === 'undefined'; typeof null === 'object' (a famous bug).
What is the 'this' keyword bound to in a regular function vs arrow function?
Regular functions: 'this' is bound at call-time (depends on how the function is called). Arrow functions: 'this' is lexically bound to the enclosing scope and cannot be changed with call(), apply(), or bind().
What is the difference between map() and forEach()?
map() returns a new array with transformed elements and can be chained. forEach() returns undefined, executes a callback for side effects only, and cannot be chained. Use map() when you need a result, forEach() for side effects.
What happens when you compare arrays or objects with == or ===?
Both == and === compare by reference, not by value. [1,2] === [1,2] is false because they are different objects in memory. Use JSON.stringify() for value comparison or libraries like lodash isEqual() for deep equality.
What is a closure in JavaScript?
A closure is a function that has access to variables from its outer (enclosing) scope even after that outer function has returned. Inner functions retain access to their parent's variables, creating a persistent reference to those variables.
What is the difference between slice() and splice()?
slice(start, end) returns a shallow copy of a portion of an array without modifying the original. splice(start, deleteCount, items) modifies the array in-place by removing/replacing elements and returns the removed elements.
What does the spread operator (...) do, and what's a common gotcha?
Spread operator unpacks iterables (arrays, strings) or object properties. Common gotcha: [...obj] doesn't work because objects are not iterable; use {...obj} instead. Spread creates shallow copies—nested objects are still referenced, not cloned.
Make your own JavaScript study set
Flashcards for related topics
Studying JavaScript to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →