JavaScript Reference
Built-in JavaScript methods and functions: strings, arrays, numbers, Math, objects, JSON and more.
86 of 86
| Name | Group | Description |
|---|---|---|
| String.length | String | The number of characters in a string. |
| toUpperCase() | String | Returns the string in upper case. |
| toLowerCase() | String | Returns the string in lower case. |
| trim() | String | Removes whitespace from both ends. |
| slice() | String | Extracts part of a string. |
| substring() | String | Extracts characters between two indexes. |
| indexOf() | String | The position of the first match, or -1. |
| includes() | String | Whether a string contains text. |
| startsWith() | String | Whether a string starts with text. |
| endsWith() | String | Whether a string ends with text. |
| replace() | String | Replaces the first match. |
| replaceAll() | String | Replaces every match. |
| split() | String | Splits a string into an array. |
| repeat() | String | Repeats a string. |
| padStart() | String | Pads the start to a length. |
| padEnd() | String | Pads the end to a length. |
| charAt() | String | The character at an index. |
| at() | String | The character at an index; negative counts from the end. |
| concat() | String | Joins strings. |
| match() | String | Finds matches with a regular expression. |
| localeCompare() | String | Compares strings for sorting. |
| Array.length | Array | The number of items in an array. |
| push() | Array | Adds items to the end. |
| pop() | Array | Removes and returns the last item. |
| shift() | Array | Removes and returns the first item. |
| unshift() | Array | Adds items to the start. |
| slice() | Array | Copies part of an array. |
| splice() | Array | Adds or removes items in place. |
| concat() | Array | Joins arrays. |
| join() | Array | Joins items into a string. |
| reverse() | Array | Reverses an array in place. |
| sort() | Array | Sorts an array in place. |
| indexOf() | Array | The first index of an item, or -1. |
| includes() | Array | Whether an array contains an item. |
| find() | Array | The first item that passes a test. |
| findIndex() | Array | The index of the first item that passes a test. |
| filter() | Array | A new array of items that pass a test. |
| map() | Array | A new array made by transforming each item. |
| reduce() | Array | Combines all items into one value. |
| forEach() | Array | Runs a function for each item. |
| some() | Array | Whether any item passes a test. |
| every() | Array | Whether every item passes a test. |
| flat() | Array | Flattens nested arrays. |
| flatMap() | Array | Maps then flattens one level. |
| fill() | Array | Fills an array with a value. |
| Array.isArray() | Array | Whether a value is an array. |
| Array.from() | Array | Makes an array from an iterable. |
| at() | Array | The item at an index; negative counts from the end. |
| Number() | Number | Converts a value to a number. |
| parseInt() | Number | Parses an integer from a string. |
| parseFloat() | Number | Parses a decimal from a string. |
| toFixed() | Number | Formats a number with fixed decimals. |
| Number.isInteger() | Number | Whether a value is an integer. |
| isNaN() | Number | Whether a value is NaN. |
| Math.round() | Math | Rounds to the nearest integer. |
| Math.floor() | Math | Rounds down. |
| Math.ceil() | Math | Rounds up. |
| Math.trunc() | Math | Removes the decimal part. |
| Math.abs() | Math | The absolute value. |
| Math.max() | Math | The largest of the arguments. |
| Math.min() | Math | The smallest of the arguments. |
| Math.pow() | Math | Raises to a power. |
| Math.sqrt() | Math | The square root. |
| Math.random() | Math | A random number from 0 up to (not including) 1. |
| Math.PI | Math | The value of pi. |
| Object.keys() | Object | An array of an object's property names. |
| Object.values() | Object | An array of an object's values. |
| Object.entries() | Object | An array of [key, value] pairs. |
| Object.assign() | Object | Copies properties into an object. |
| Object.freeze() | Object | Makes an object read only. |
| hasOwnProperty() | Object | Whether an object has its own property. |
| JSON.stringify() | JSON | Converts a value to JSON text. |
| JSON.parse() | JSON | Converts JSON text to a value. |
| console.log() | Console | Prints values to the console. |
| setTimeout() | Timers | Runs a function once after a delay. |
| setInterval() | Timers | Runs a function repeatedly. |
| Promise | Async | An object for a value that arrives later. |
| async / await | Async | Write asynchronous code that reads in order. |
| Date | Date | Works with dates and times. |
| Date.now() | Date | Milliseconds since 1 January 1970. |
| typeof | Operators | The type of a value. |
| Set | Collections | A collection of unique values. |
| Map | Collections | A collection of key-value pairs. |
| RegExp.test() | RegExp | Tests a string against a pattern. |
| structuredClone() | Global | Makes a deep copy of a value. |
| encodeURIComponent() | Global | Encodes text for use in a URL. |