JavaScript (ES2026) reference · 11 entries

JavaScript JSON and Global Functions

JSON.parse(), JSON.stringify() and global functions such as parseInt(), isNaN(), encodeURIComponent() and structuredClone(), with common mistakes and examples.

Global functions are available everywhere without a prefix. Several have stricter, clearer replacements on Number (Number.isNaN(), Number.parseInt()); prefer those in new code.

NameDescriptionSince
JSON.parse() Turn a JSON string into a JavaScript value. Throws SyntaxError on invalid JSON; an optional reviver transforms values. ES5
JSON.stringify() Convert a JavaScript value to a JSON string, optionally filtering keys and pretty-printing with indentation. ES5
parseInt() Parse an integer from the start of a string in a given base. Always pass the radix, e.g. parseInt("08", 10). ES1
parseFloat() Parse a decimal number from the start of a string, stopping at the first character that can't be part of it. ES1
isNaN() Return true if a value is NaN after converting it to a number, so isNaN("hello") is true. Prefer Number.isNaN(). ES1
isFinite() Return true if a value is a finite number after converting it to a number. Prefer Number.isFinite() for strict checks. ES1
encodeURIComponent() Encode a string for use as one part of a URL (a query value or path segment), escaping &, =, ?, / and spaces. ES3
decodeURIComponent() Decode a URL component encoded by encodeURIComponent(), turning %20-style escapes back into characters. ES3
encodeURI() Encode a complete URL, leaving characters with special meaning in URLs (like :, /, ? and &) untouched. ES3
decodeURI() Decode a full URL encoded by encodeURI(), keeping escape sequences that represent reserved URL characters. ES3
structuredClone() Create a deep copy of a value, including nested objects, arrays, Dates, Maps and Sets. Functions can't be cloned. HTML (2022)

Was this page helpful?