Questions

JavaScript questions

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

Detect a Click Outside an Element in jQuery

Learn how to detect clicks outside an element in jQuery to close menus, modals, and dropdowns with clear examples and common pitfalls.

javascriptjqueryclick

Disable an ESLint Rule for One Line in JavaScript

Learn how to disable a specific ESLint rule for one JavaScript line, a code block, or an entire file using ESLint directive comments safely.

javascriptjshinteslint

Extract Object Property Values with JavaScript Array.map()

Learn how to extract one property from an array of JavaScript objects using Array.map(), computed keys, and safe handling of missing values.

javascriptjavascript-objects

Find an Object in a JavaScript Array by Property Value

Learn how to search an array of JavaScript objects by ID using find(), filter(), and jQuery, including safe type handling and examples.

javascriptarraysjavascript-objects

Format Numbers With Thousands Separators in JavaScript

Learn how to format numbers with commas as thousands separators in JavaScript using toLocaleString, Intl, and custom methods.

javascriptformattingnumbers

Generate Random Integers in a Range in JavaScript

Learn how to generate random whole numbers between two values in JavaScript, including inclusive ranges, formulas, examples, and common mistakes.

javascriptrandominteger

Generate a Random Number in a Range in JavaScript

Learn how to generate random numbers between two values in JavaScript, including inclusive ranges, formulas, examples, and common mistakes.

javascriptrandom

Generate a Random String in JavaScript

Learn how to generate a fixed-length random string in JavaScript using a custom character set like a-z, A-Z, and 0-9.

javascriptstringrandom

Get Screen, Page, and Browser Window Size in JavaScript

Learn how to get screen size, viewport size, page size, and scroll position in JavaScript across major browsers with clear examples.

javascripthtmljquerylayout

Get an HTML Element’s X and Y Position in JavaScript

Learn how to retrieve an HTML element’s X and Y coordinates in JavaScript with getBoundingClientRect, scroll offsets, and practical examples.

javascripthtmlcssdom

Get the Last Array Item in JavaScript

Learn how to access last, second-last, and conditional array items in JavaScript, with URL path examples and safer indexing patterns.

javascriptarrays

Get the Selected Radio Button Value with jQuery

Learn how to find the selected radio button in a form with jQuery using :checked, read its value, and handle common mistakes.

javascriptjqueryhtmljquery-selectors

How AngularJS Data Binding and the Digest Cycle Work

Learn how AngularJS detects model changes with dirty checking, watchers, and the digest cycle, including when to use $apply for external code.

javascriptangularjsdata-binding

How JavaScript Closures Work: A Beginner-Friendly Guide

Learn how JavaScript closures work with simple explanations, examples, common mistakes, and practical use cases for real code.

javascriptfunctionvariablesscope

How JavaScript Prototype Works: Constructors, Inheritance, and new

Learn how JavaScript prototypes work, how constructor functions and new create objects, and how prototype-chain method lookup works.

javascriptdynamic-languagesprototype-oriented

How to Add Elements to the Beginning of an Array in JavaScript

Learn how to prepend elements to the start of a JavaScript array using built-in methods like unshift and practical examples.

javascriptarrays

How to Append Items to an Array in JavaScript

Learn how to append strings, numbers, and objects to arrays in JavaScript using push, spread syntax, and immutable patterns.

javascriptarraysappend

How to Change an Element's Class with JavaScript

Learn how to change, add, remove, and toggle an HTML element's class with JavaScript using events like click.

javascripthtmldom

How to Check If a Variable Exists in JavaScript

Learn the correct ways to check whether a variable is defined, initialized, null, or truthy in JavaScript with examples.

javascriptfunctionvariablesinitialization

How to Check If a Variable Is a String in JavaScript

Learn how to check whether a variable is a string in JavaScript using typeof, instanceof, and safe patterns with clear examples.

javascriptstring

Page 2 of 8 - 151 questions