Questions

JavaScript questions

Choose a question page, learn the concept, then test your understanding with a quiz.

How to Sort an Array of Objects by a String Property in JavaScript

Learn how to sort JavaScript arrays of objects by a string property using sort() and localeCompare() with clear examples.

javascriptarrayssortingcomparison

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.

javascriptstringuppercase

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.

javascriptoperatorsequalityequality-operator

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.

javascriptloopsclosures

JavaScript DOM Ready Without jQuery: $(document).ready Equivalent

Learn how to replace jQuery's $(document).ready with native JavaScript using DOMContentLoaded and readyState.

javascriptjquerypageload

JavaScript Function Expressions vs Function Declarations

Learn the difference between JavaScript function expressions and function declarations, including hoisting, scope, pros, cons, and examples.

javascriptfunctionmethodssyntax

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.

javascripthtmlperformanceoptimization

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.

javascriptsleep

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.

javascriptfunctionperformance

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.

javascriptscopeecmascript-6var

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.

javascriptreactjsreact-router

Thinking in AngularJS for jQuery Developers

Learn the AngularJS mindset shift from jQuery: data binding, MVC-style structure, directives, services, and app design basics.

javascriptjqueryangularjs

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.

javascriptnode.jspromiseasync-await

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.

javascriptsyntaxjslintuse-strict

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.

javascriptjsonjsonpterminology

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.

javascriptoperators

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.

javascriptjquerycorspostman

Why Some JSON Responses Start with while(1); in JavaScript

Learn why APIs prepend while(1); to JSON, how it helps prevent JSON hijacking, and what safer modern alternatives exist.

javascriptjsonajaxsecurity

event.preventDefault() vs return false in JavaScript and jQuery

Learn the difference between event.preventDefault() and return false in JavaScript and jQuery, including propagation, defaults, and best practices.

javascriptjqueryevent-handlingdom-events

jQuery .prop() vs .attr(): Understanding Properties and Attributes

Learn the difference between jQuery .prop() and .attr(), when to use each, and why style, checked, and selected behave differently.

javascriptjquerydomattr

Page 3 of 3 - 60 questions