JavaScript String Methods
A reference of the 37 standard (non-Annex B) JavaScript String methods, covering both String.prototype instance methods and the static methods on String itself (fromCharCode, fromCodePoint, raw). Each record documents the method name, its full call signature with parameter types, the return type, a concise description of its behavior and edge cases, and the ECMAScript edition in which it was standardized — from ES1 foundational methods like indexOf and charAt through ES2024 additions toWellFormed and isWellFormed.
Quick fetch
Stable URL. CORS-enabled. No auth.
curl https://staticdata.dev/v1/js-string-methods.json
Or use as a typed import:
import { jsStringMethods } from "https://staticdata.dev/v1/js-string-methods.ts"
Formats
- JSON 10.5 KB
/v1/js-string-methods.json
min: 9.2 KB · /v1/js-string-methods.min.json
- CSV 6.9 KB
/v1/js-string-methods.csv
- TypeScript 10.8 KB
/v1/js-string-methods.ts
export const jsStringMethods
type StringMethod = (typeof jsStringMethods)[number]
Schema
Each record in the dataset has the following shape.
| Field | Type | Description | Example |
|---|---|---|---|
| name | string | Method name (no prototype prefix) | slice |
| signature | string | Full call signature including parameters and optional markers | String.prototype.slice(beginIndex, endIndex?) |
| returns | string | TypeScript-style return type | string |
| description | string | Concise description of what the method does and notable edge cases | Extracts a section of a string and returns it as a new string. |
| ecmaVersion | string | ECMAScript edition that introduced this method (e.g. ES1, ES2015, ES2024) | ES2015 |
Preview
First 10 records.
| name | signature | returns | description | ecmaVersion |
|---|---|---|---|---|
| at | String.prototype.at(index) | string | undefined | Returns the character at the given index, supporting negative indices to count from the end of the string. | ES2022 |
| charAt | String.prototype.charAt(index) | string | Returns a new string consisting of the single UTF-16 code unit at the given index. Returns an empty string if the index is out of range. | ES1 |
| charCodeAt | String.prototype.charCodeAt(index) | number | Returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index. Returns NaN if the index is out of range. | ES1 |
| codePointAt | String.prototype.codePointAt(pos) | number | undefined | Returns a non-negative integer that is the Unicode code point value of the character at the given position. Returns undefined if the position is out of range. | ES2015 |
| concat | String.prototype.concat(...strings) | string | Concatenates the string arguments to the calling string and returns a new string. | ES3 |
| endsWith | String.prototype.endsWith(searchString, endPosition?) | boolean | Determines whether a string ends with the characters of a specified string. Returns true or false. | ES2015 |
| fromCharCode | String.fromCharCode(...codes) | string | Returns a string created from the specified sequence of UTF-16 code unit values. This is a static method on String, not on String.prototype. | ES1 |
| fromCodePoint | String.fromCodePoint(...codePoints) | string | Returns a string created by using the specified sequence of Unicode code points. This is a static method on String, not on String.prototype. | ES2015 |
| includes | String.prototype.includes(searchString, position?) | boolean | Determines whether one string may be found within another string, returning true or false. | ES2015 |
| indexOf | String.prototype.indexOf(searchValue, fromIndex?) | number | Returns the index of the first occurrence of a specified value in a string. Returns -1 if the value is not found. | ES1 |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/js-string-methods.json | jq '.[0]' import type { StringMethod } from "https://staticdata.dev/v1/js-string-methods.ts";
const res = await fetch("https://staticdata.dev/v1/js-string-methods.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const jsStringMethods: StringMethod[] = await res.json();
console.log(jsStringMethods[0]); import urllib.request, json
with urllib.request.urlopen("https://staticdata.dev/v1/js-string-methods.min.json") as r:
jsStringMethods = json.load(r)
print(jsStringMethods[0]) package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://staticdata.dev/v1/js-string-methods.min.json")
if err != nil { panic(err) }
defer resp.Body.Close()
var data []map[string]any
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
panic(err)
}
fmt.Println(data[0])
} use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let body = ureq::get("https://staticdata.dev/v1/js-string-methods.min.json").call()?.into_string()?;
let data: Vec<Value> = serde_json::from_str(&body)?;
println!("{:?}", data.first());
Ok(())
} Sources and methodology
This dataset enumerates every standard method defined on String.prototype as well as the three static methods on String itself (fromCharCode, fromCodePoint, and raw), drawing from the MDN Web Docs String reference and the ECMAScript specification maintained by TC39. Methods are sorted alphabetically by name. Each record captures the authoritative call signature using TypeScript-style optional parameter notation (?), the return type expressed in TypeScript notation, a description that covers both typical usage and important edge-case behavior (such as how substring treats negative indices differently from slice), and the ECMAScript edition in which the method was first standardized.
ECMAScript version labels use the modern year-based naming convention where applicable (ES2015 rather than ES6, ES2017 rather than ES8, and so on). Legacy methods that predate the year-based convention are labeled ES1, ES3, or ES5 per the numbered editions. The set is complete as of ES2026 (October 2026); the most recent additions are from ES2024 (isWellFormed and toWellFormed), which address well-formedness of strings containing lone surrogate code units — a correctness concern when passing JavaScript strings to APIs that require valid Unicode sequences such as encodeURIComponent or TextEncoder.
Note that the legacy web-compatibility methods in ECMA-262 Annex B are not included: the trimLeft/trimRight aliases, substr, and the HTML wrapper methods (anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link, small, strike, sub, sup). They still exist in browsers and Node.js but are discouraged for new code. The dataset reflects the normative set a developer should know and reference, not the exhaustive list of every historically shipped string API.
Versioning
URLs under /v1/ are stable: field names and types will not change in a way
that breaks consumers. Values can be corrected or records added when the upstream source
changes; schema-incompatible updates ship under a new version path. See the
js-string-methods changelog for this dataset's history.
Related datasets
More Code datasets
- ansi-colors
- ascii
- cron-presets
- css-at-rules
- css-functions
- css-named-colors
- css-pseudo-classes
- css-pseudo-elements
- css-units
- data-units
- exit-codes
- file-signatures
- hash-algorithms
- js-array-methods
- js-math-methods
- js-object-methods
- json-schema-keywords
- jwt-claims
- mathematical-constants
- measurement-units
- node-builtin-modules
- owasp-top-10
- periodic-table
- physical-constants
- posix-signals
- programming-languages
- regex-flags
- regex-patterns
- roman-numerals
- si-base-units
- si-derived-units
- si-prefixes
- spdx-licenses
- strftime-tokens
- tailwind-colors
- time-units
- unicode-blocks
- unicode-general-categories
- unicode-planes
- unix-file-permissions
- xterm-256-colors