JavaScript Tutorials
Practical JavaScript tutorials covering DOM manipulation, string methods, encoding, timers, and modern browser APIs.
querySelector & querySelectorAll
Select DOM elements using CSS selectors with querySelector() and querySelectorAll().
document.getElementById()
Access elements by their ID attribute using the classic getElementById method.
getElementsByTagName
Select elements by HTML tag name and iterate through live HTMLCollections.
createElement & insertBefore
Dynamically create and insert DOM elements with createElement and insertBefore.
innerHTML & outerHTML
Read and replace HTML content using innerHTML and outerHTML properties.
setTimeout in JavaScript
Delayed execution with setTimeout - syntax, patterns, and common pitfalls.
Disable Button & Re-enable
Disable a button with JavaScript and re-enable it after a countdown timer.
trim(), ltrim(), rtrim()
Remove whitespace from strings using trim, trimStart, and trimEnd methods.
Base64 Encode & Decode
Encode and decode Base64 strings using btoa(), atob(), and Buffer in Node.js.
SHA512 Hash Generator
Generate SHA-512 hashes in JavaScript with the Web Crypto API.
Convert XML to JSON
Convert XML data to JSON format using DOMParser and recursive parsing.
JavaScript in PHP
Embed JavaScript in PHP scripts, pass data between languages, and best practices.
About These JavaScript Tutorials
JavaScript is the programming language of the web. Every modern browser includes a JavaScript engine, making it the only language that runs natively on the client side without plugins or compilation. These tutorials cover the practical JavaScript skills that web developers use daily — from selecting and manipulating DOM elements to encoding data, handling timers, and converting between data formats.
Each tutorial is structured around real-world use cases with working code examples you can copy and adapt. The DOM manipulation tutorials (querySelector, getElementById, getElementsByTagName, createElement) form the foundation of interactive web development. The utility tutorials cover common tasks like string trimming, Base64 encoding, SHA-512 hashing, and XML-to-JSON conversion that come up in nearly every project.
Whether you are building your first interactive web page or looking for a quick reference on a specific API, these guides provide concise, tested solutions with clear explanations of how and why each approach works. All examples use vanilla JavaScript with no framework dependencies, so the patterns apply regardless of whether you later adopt React, Vue, Angular, or any other library.