Questions
JavaScript questions
Choose a question page, learn the concept, then test your understanding with a quiz.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
How to Pretty-Print JSON in JavaScript
Learn how to pretty-print JSON in JavaScript using JSON.stringify, indentation, formatting options, and display techniques for readable output.
How to Redirect to Another Webpage in JavaScript
Learn how to redirect users to another webpage using JavaScript, including location.href, replace(), and common redirect patterns.
How to Remove Duplicate Values from a JavaScript Array
Learn how to remove duplicate values from a JavaScript array using Set, filter, and loops with clear examples and common mistakes.
How to Remove a Property from a JavaScript Object
Learn how to remove a property from a JavaScript object using delete and object rest syntax, with examples, mistakes, and use cases.
How to Remove a Specific Item from an Array in JavaScript
Learn how to remove a specific value from a JavaScript array using core methods like filter, splice, and indexOf with clear examples.
How to Replace All Occurrences of a String in JavaScript
Learn how to replace all occurrences of a substring in JavaScript using replaceAll, regular expressions, and safe patterns.
How to Return Values from Asynchronous Functions in JavaScript
Learn why async functions return undefined and how to use callbacks, Promises, and async/await correctly in JavaScript.
How to Round to At Most 2 Decimal Places in JavaScript
Learn how to round numbers to at most 2 decimal places in JavaScript without forcing unnecessary trailing zeros.
How to Select Child Elements from $(this) in jQuery
Learn how to get child elements from $(this) in jQuery, including .children(), .find(), click handlers, and common selector mistakes.
How to Set a Checkbox as Checked in jQuery
Learn how to check and uncheck checkboxes in jQuery using prop(), attr(), and selectors with clear examples and common mistakes.