Questions
JavaScript questions
Choose a question page, learn the concept, then test your understanding with a quiz.
JavaScript call() vs apply(): Difference, Use Cases, and Examples
Learn the difference between JavaScript call() and apply(), when to use each, syntax examples, and whether there are performance differences.
JavaScript let vs var: Scope, Hoisting, and When to Use Each
Learn the difference between let and var in JavaScript, including scope, hoisting, redeclaration, and when to use let instead of var.
JavaScript new Keyword: Constructors, Objects, and When to Use It
Learn what JavaScript's new keyword does, how constructor calls create objects, when to use classes, and when factory functions are clearer.
JavaScript this Keyword: How It Works and When to Use It
Learn how JavaScript's this keyword is determined by a function call, including methods, constructors, classes, arrow functions, and bind.
Merge and De-duplicate Arrays in JavaScript with Set
Learn how to merge JavaScript arrays and remove duplicate values while preserving the order in which unique items first appear.
Preview an Image Before Uploading with JavaScript
Learn how to preview a selected image in the browser before upload using JavaScript, file inputs, Blob URLs, and cleanup.
Programmatic Navigation in React Router Explained
Learn how to navigate in code with React Router, including history, router context, and redirect patterns for components and events.
React JSX Spread Attributes: What ...props Does
Learn what the three dots (...) mean in React JSX, how spread attributes pass props, and why attribute order affects overridden values.
Remove a Key from a JavaScript Object with delete
Learn how to remove a key from a JavaScript object using delete, avoid common pitfalls, and create immutable object copies.
Remove the Last Character from a JavaScript String
Learn how to remove the final character from a JavaScript string with slice(), substring(), and safe validation examples.
Rendering Repeated Components in React JSX with map and Array.from
Learn how to render a component multiple times in React JSX using map, Array.from, keys, and reusable data-driven patterns.
Same-Origin Policy in Chrome: CORS and Safe Development Options
Learn how Chrome's same-origin policy works, why disabling it is unsafe, and how to use CORS and local servers for development.
Scroll to Top of a Page with JavaScript
Learn how to instantly scroll to the top of a web page with JavaScript using window.scrollTo, including examples and common pitfalls.
Stop Iteration Early in JavaScript: forEach, break, and Alternatives
Learn why JavaScript forEach cannot use break and how to stop array iteration early with for...of, some(), every(), and find().
Thinking in AngularJS for jQuery Developers
Learn the AngularJS mindset shift from jQuery: data binding, MVC-style structure, directives, services, and app design basics.
Using Variables in JavaScript Regular Expressions
Learn how to build JavaScript regular expressions from variables, escape literal text safely, and replace every matching occurrence.
Using async/await with forEach in JavaScript
Learn why async/await inside forEach can cause problems in JavaScript, and see better patterns like for...of and Promise.all.
Validate Date Instances in JavaScript: Detect Invalid Dates
Learn how to detect invalid JavaScript Date instances with getTime(), Number.isNaN(), cross-realm checks, examples, and common pitfalls.
What "use strict" Does in JavaScript and Why It Matters
Learn what "use strict" does in JavaScript, why it was added, how browsers handle it, and when it still matters in modern code.
What Does javascript:void(0) Mean in JavaScript Links?
Learn what javascript:void(0) means, why it appears in links, how it works, and better modern alternatives in HTML and JavaScript.