Questions
JavaScript questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Uppercase the First Letter of a String in JavaScript
Learn how to uppercase the first letter of a string in JavaScript without changing the rest of the text, with examples and common mistakes.
How to Validate Decimal Numbers in JavaScript
Learn how to validate decimal numbers in JavaScript, including negatives and leading decimals, with clear rules and practical examples.
JavaScript == vs ===: Which Equality Operator Should You Use?
Learn the difference between == and === in JavaScript, when to use each, type coercion rules, common pitfalls, and best practices.
JavaScript Closures in Loops: How to Capture the Correct Loop Variable Value
Learn why JavaScript closures in loops capture the wrong value and how to fix it using let, IIFEs, and function factories.
JavaScript DOM Ready Without jQuery: $(document).ready Equivalent
Learn how to replace jQuery's $(document).ready with native JavaScript using DOMContentLoaded and readyState.
JavaScript Default Parameters: Set Optional Function Argument Values
Learn how default parameters work in JavaScript functions, including syntax, examples, common mistakes, and practical use cases.
JavaScript Function Expressions vs Function Declarations
Learn the difference between JavaScript function expressions and function declarations, including hoisting, scope, pros, cons, and examples.
JavaScript Links: Should You Use href="#" or javascript:void(0)?
Learn why href="#" and javascript:void(0) are usually the wrong choice for JavaScript actions, and what to use instead.
JavaScript Sleep: Why There Is No Real sleep() and What to Use Instead
Learn why JavaScript has no true sleep() on the main thread and how to pause work safely using setTimeout, Promises, and async/await.
JavaScript String Formatting Alternatives to printf and String.Format
Learn JavaScript alternatives to printf and String.Format, including number formatting, thousand separators, and date formatting.
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.
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.
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 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.
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.
What Is JSONP in JavaScript? Why It Was Created and How It Works
Learn what JSONP is, why it was created, how it bypassed browser restrictions, and when to use modern alternatives like CORS.
What the Double Exclamation Mark (!!) Does in JavaScript
Learn what !! means in JavaScript, how it converts values to true or false, and when to use it with clear examples and common pitfalls.
Why Browsers Enforce CORS but Postman Does Not in JavaScript
Learn why browser JavaScript gets CORS errors while Postman works, and how Same-Origin Policy affects fetch and XMLHttpRequest.