What is a real-life example of JavaScript?
See what JavaScript does in a real web app such as Google Maps: events, fetch requests and live DOM updates, with a working search-as-you-type example.
466 posts about JavaScript: questions with answers, tutorials and articles, newest first.
See what JavaScript does in a real web app such as Google Maps: events, fetch requests and live DOM updates, with a working search-as-you-type example.
JavaScript is the language browsers run natively, making pages interactive and dynamic. Learn its main benefits with modern, accessible examples.
JavaScript is mostly used to make web pages interactive. See examples of event handling, form validation and fetch, and its uses beyond the browser.
See what JavaScript does in practice: handle events, change the DOM, validate forms and load data, with short examples you can run.
JavaScript is the language that makes web pages interactive and also runs on servers. See how it works, with the DOM, fetch and Node.js examples.
Detect features instead of browsers, set a browserslist target, transpile and polyfill only what you need, and test in Chromium, Firefox and WebKit.
Select elements with querySelector, change content, classes and attributes, create and remove nodes, and handle events safely with modern DOM APIs.
The DOM represents the document you can modify, while the BOM gives access to the browser itself. Learn the objects, the hierarchy and modern best practice.
A higher-order function takes a function, returns one, or both. See map, filter, reduce, closures, wrappers and composition with tested examples.
A closure is a function bundled with the scope where it was created. Learn how to create one and use it for private state and callbacks.
Local variables live inside a function or block; globals are visible everywhere and can clash. Learn scope rules, hoisting and best practice.
Synchronous functions block until they return, asynchronous ones finish later. See promises, async/await and the event loop in action.
for...in iterates property names as strings; for...of iterates values from iterables like arrays and maps. See examples and when to use each.
Template literals use backticks for interpolation with ${}, multi-line strings and tagged templates. Examples and common mistakes included.
Arrow functions inherit this and cannot be constructors, while function expressions get their own this and arguments. Compare them with clear examples.
toUpperCase is locale-independent, while toLocaleLowerCase follows locale rules such as Turkish dotted and dotless i. See examples and when to use each.
trimRight() removes trailing whitespace and is an alias of trimEnd(), while toLowerCase() changes letter case. See examples and how to combine them.
trimEnd() trims the end of a string, while trimLeft() is a legacy alias of trimStart() that trims the start. Learn which names to use in new code.
trim() cleans both ends of a string while trimStart() cleans only the beginning. Examples, what counts as whitespace and when to choose each.
concat() appends values to a string, while join() turns an array into one string with a separator. There is no String.join; learn when to use each.