Questions

JavaScript questions

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

How to Encode a URL in JavaScript for Query Strings

Learn how to safely encode URLs in JavaScript for GET parameters using encodeURIComponent, with examples and common mistakes.

javascripturlencodeurlencode

How to Format Numbers as Currency Strings in JavaScript

Learn how to format numbers as currency strings in JavaScript using toFixed and Intl.NumberFormat with clear examples.

javascriptformattingcurrencynumber-formatting

How to Format a Date in JavaScript

Learn how to format JavaScript Date objects into strings like 10-Aug-2010 using built-in methods and simple custom formatting.

javascriptdatedatetimedatetime-format

How to Get Query String Values in JavaScript

Learn how to read query string parameters in JavaScript using URLSearchParams and classic approaches, with examples and common mistakes.

javascripturlpluginsquery-string

How to Get Selected Text from a Select Box in jQuery

Learn how to get the selected option text from a select box in jQuery, with examples, common mistakes, and practical usage patterns.

javascriptjquerydomdrop-down-menu

How to Get a Timestamp in JavaScript

Learn how to get the current timestamp in JavaScript, including Unix time, milliseconds, seconds, and common date pitfalls.

javascriptdatetimetimestampdate-arithmetic

How to Get the Current Date in JavaScript

Learn how to get the current date in JavaScript using Date, format it, and understand common mistakes with practical examples.

javascriptdatedate-formatting

How to Get the Current URL in JavaScript

Learn how to get the current page URL in JavaScript using window.location, with examples, common mistakes, and practical use cases.

javascripturl

How to Get the Length of a JavaScript Object

Learn how to count properties in a JavaScript object using Object.keys(), when it works, and common mistakes to avoid.

javascriptobjectjavascript-objects

How to Get the Selected Value from a Dropdown in JavaScript

Learn how to get the selected value from an HTML dropdown using JavaScript, with examples, common mistakes, and practical use cases.

javascripthtml-select

How to Include One JavaScript File in Another JavaScript File

Learn how JavaScript files are loaded and how to share code using script tags and ES modules in modern JavaScript.

javascriptfileimportinclude

How to Insert an Item into an Array at a Specific Index in JavaScript

Learn how to insert values into a JavaScript array at a specific index using splice, with examples, pitfalls, and real-world use cases.

javascriptarrays

How to Iterate Through Object Properties in JavaScript

Learn how for...in works in JavaScript, why the loop variable receives object property names, and how to iterate safely.

javascriptloopsobject

How to Loop Through a JavaScript Object of Nested Objects

Learn how to iterate through a JavaScript object whose values are objects, using for...in, Object.keys, and Object.entries.

javascriptloops

How to Loop Through a JavaScript Object: Keys, Values, and Entries

Learn how to loop through a JavaScript object and access its keys and values using for...in, Object.keys, Object.values, and Object.entries.

javascriptloopsfor-loopeach

How to Loop Through an Array in JavaScript

Learn how to loop through array entries in JavaScript using for, for...of, forEach, and other common patterns with examples.

javascriptarraysloopsforeach

How to Loop Through an Array in JavaScript

Learn how to loop through array items in JavaScript using for, for...of, forEach, and map with clear examples and common mistakes.

javascriptarraysloopsfor-loop

How to Map Over Object Properties in JavaScript

Learn how to transform object values in JavaScript using Object.keys, Object.entries, and Object.fromEntries when no native object map exists.

javascriptnode.jsfunctional-programmingmap-function

How to Measure Function Execution Time in JavaScript

Learn how to measure function execution time in JavaScript using performance.now(), Date.now(), and practical timing patterns.

javascriptprofiling

How to Merge JavaScript Objects: Object.assign, Spread Syntax, and Practical Patterns

Learn how to merge JavaScript objects using Object.assign and spread syntax, including examples, overwrite behavior, and common mistakes.

javascriptjavascript-objects

Page 3 of 6 - 104 questions