On this page
  1. JSON, Math, BigInt & Date
  2. Contents
  3. JSON & structuredClone()
  4. Math & BigInt
  5. Date

JSON, Math, BigInt & Date

Prev: String, RegExp & Intl | Up: builtins | Next: tutorials
Rel: String, RegExp & Intl, Fetch & Networking
Ref: MDN Web Docs — JSON
Tags: #public #web #javascript #builtins


Contents


JSON & structuredClone()

const original = { created: new Date(), tags: new Set(["js", "web"]) };
const copy = structuredClone(original);

Math & BigInt

JavaScript Number is IEEE 754 double-precision (exact integers up to Number.MAX_SAFE_INTEGER = 2**53 - 1). Use BigInt (123n) for arbitrary-precision integers.

const exact = 9007199254740993n + 1n; // 9007199254740994n

Date

Store and transmit timestamps in UTC ISO-8601 (new Date().toISOString()) and format for display with Intl.DateTimeFormat.

Linked from

Related notes