Caution
JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.
Dictionary
- Home
- JavaScript Dictionary
JavaScript Dictionary Index
| [Setup] JavaScript Development Environment | Step-by-step guide to setting up an environment for running JavaScript. |
| document.querySelector() | Gets the first HTML element matching the given CSS selector. |
| document.querySelectorAll() | Gets all HTML elements matching the given CSS selector. |
| document.getElementById() | Gets the HTML element with the specified ID. |
| HTML Element .textContent | Gets or sets the text content of an HTML element without interpreting HTML tags. |
| HTML Element .innerHTML | Gets or sets the inner HTML of an element as a string. |
| HTML Element .classList | Adds, removes, toggles, or checks for classes on an HTML element. |
| HTML Element .getAttribute() | Gets the value of the specified attribute of an HTML element. |
| HTML Element .setAttribute() | Sets the specified attribute on an HTML element. |
| document.createElement() | Creates a new HTML element with the specified tag name. |
| Parent Element .appendChild() | Appends an HTML element as the last child of a parent element. |
| HTML Element .addEventListener() | Registers an event listener on an HTML element. |
| HTML Element .remove() / removeChild() | Removes an HTML element; remove() removes itself, removeChild() removes a child element. |
| Parent Element .replaceChild() / insertBefore() | Replaces or inserts a child element; replaceChild() replaces and insertBefore() inserts at a specific position. |
| HTML Element .cloneNode() | Clones an HTML element; the argument specifies whether to include child elements. |
| HTML Element .closest() / matches() | Searches or tests HTML elements by selector; closest() searches ancestors, matches() checks if the element itself matches. |
| HTML Element .style | Manipulates inline styles; gets, sets, or removes CSS properties. |
| HTML Element .dataset | Reads and writes data attributes; accesses data-* attributes using camelCase. |
| HTML Element .innerText | Gets or sets the displayed text content, with a comparison to textContent. |
| document.createTextNode() / createDocumentFragment() | Creates a text node or document fragment, also useful for XSS prevention. |
| HTML Element .parentNode / parentElement | Gets the parent element, with a comparison between parentNode and parentElement. |
| HTML Element .children / firstElementChild / lastElementChild | Gets child elements; children returns all children, first/last returns the first or last. |
| HTML Element .nextElementSibling / previousElementSibling | Gets sibling elements; retrieves the next or previous HTML element. |
| HTML Element .removeEventListener() | Removes an event listener; note that anonymous functions cannot be removed. |
| event.target / currentTarget | Gets the event source element; target is the actual element, currentTarget is where the listener is registered. |
| event.preventDefault() / stopPropagation() | Cancels or stops event propagation; suppresses default behavior and controls bubbling. |
| HTML Element .dispatchEvent() | Fires a custom event; CustomEvent allows attaching data to the event. |
| Array .push() / pop() / shift() / unshift() | Adds or removes elements at the end or beginning of an array. |
| Array .splice() | Adds, removes, or replaces elements at any position in an array. |
| Array .forEach() / map() | Iterates over an array or transforms it; forEach() has no return value, map() returns a new array. |
| Array .filter() / find() / findIndex() | Extracts or searches elements that match a condition; filter() returns an array, find() returns the first match. |
| Array .reduce() | Reduces an array to a single value; useful for sums, maximums, and object conversions. |
| Array .includes() / indexOf() / lastIndexOf() | Checks for a value in an array or finds its position; includes() returns true/false, indexOf() returns the position. |
| Array .some() / every() | Tests conditions across an array; some() is true if any match, every() is true if all match. |
| Array .slice() / concat() | Extracts a portion of an array or concatenates arrays without modifying the original. |
| Array .sort() / reverse() | Sorts or reverses an array; a comparison function controls the order of numbers or strings. |
| Array .flat() / flatMap() | Flattens a nested array; flat() expands it, flatMap() performs map and flat simultaneously. |
| Array .join() / String .split() | Converts between arrays and strings; join() joins, split() splits. |
| Array.from() / Array.isArray() | Creates or checks arrays; Array.from() converts array-like objects into arrays. |
| String .indexOf() / lastIndexOf() / includes() | Searches within a string or checks for existence; indexOf() returns the position, includes() returns true/false. |
| String .startsWith() / endsWith() | Checks the beginning or end of a string; determines whether it starts or ends with a given string. |
| String .slice() / substring() | Extracts a portion of a string by specifying start and end positions. |
| String .charAt() / at() | Gets the character at a specified position; at() also supports negative indexes. |
| String .replace() / replaceAll() | Replaces text in a string; replace() replaces the first occurrence, replaceAll() replaces all. |
| String .toUpperCase() / toLowerCase() | Converts text to uppercase or lowercase; also useful for case-insensitive comparisons. |
| String .trim() / trimStart() / trimEnd() | Removes whitespace; deletes whitespace from the start, end, or both sides of a string. |
| String .padStart() / padEnd() / repeat() | Pads or repeats a string; useful for zero-padding or generating fixed-length strings. |
| Object.keys() / values() / entries() | Gets a list of object keys or values as an array for loop processing. |
| Object.assign() | Copies or merges objects; also covers comparison with spread syntax. |
| Object.freeze() / seal() | Prevents changes to an object; freeze() fully freezes it, seal() only prevents adding or deleting properties. |
| parseInt() / parseFloat() / Number() | Converts a string to a number; parseInt() converts to an integer, parseFloat() to a decimal. |
| Number.isNaN() / isFinite() / isInteger() | Checks whether a value is a number, NaN, a finite number, or an integer safely. |
| Number .toFixed() / toPrecision() | Formats a number as a string with a specified number of decimal places or significant digits. |
| Math.floor() / ceil() / round() / trunc() | Rounds a number; floor rounds down, ceil rounds up, round rounds to nearest, trunc removes decimals. |
| Math.max() / min() / abs() / random() | Compares numbers, generates random numbers, or gets absolute values; also covers use with arrays. |
| new Date() / Date.now() | Creates a date-time object; gets the current time, a specific date, or a timestamp. |
| Date .getFullYear() / getMonth() / getDate() | Gets individual date-time components such as year, month, day, and day of the week. |
| Date .toLocaleDateString() / toISOString() | Converts date-time to a string; supports locale-aware display and ISO format conversion. |
| JSON.parse() / stringify() | Converts JSON; converts between strings and objects bidirectionally. |
| new Promise() / then() / catch() / finally() | Basic Promise operations; handles success and failure of asynchronous processing. |
| Promise.all() / allSettled() / race() / any() | Controls multiple Promises; waits for all to complete, all results, the fastest, or the first success. |
| async / await | A concise syntax for asynchronous processing; writes Promises more intuitively. |
| setTimeout() / clearTimeout() | Executes a process after a specified delay; can be cancelled with clearTimeout(). |
| setInterval() / clearInterval() | Repeats a process at a specified interval; can be stopped with clearInterval(). |
| fetch() | Sends HTTP requests using a Promise-based communication API. |
| XMLHttpRequest | A traditional HTTP request method for environments where fetch() is unavailable. |
| localStorage / sessionStorage | Saves data in the browser; localStorage persists permanently, sessionStorage persists per tab. |
| console.log() / error() / warn() / table() | Outputs to the console; essential methods for debugging. |
| window.location / history | Controls page navigation and history; retrieves URLs and handles page transitions. |
| RegExp .test() / exec() | Pattern matching with regular expressions; test() returns true/false, exec() returns detailed results. |
| String .match() / matchAll() / search() | Searches strings with regular expressions; match() finds matches, search() returns the position. |
| Map | A collection that manages key-value pairs; any type can be used as a key. |
| Set | A collection that manages unique values; duplicate values are automatically removed. |
| try / catch / finally / throw | The basic syntax for error handling; controls error catching, processing, and cleanup. |