Standard library
Math
Constants: PI, E, LN2,
LN10, LOG2E, LOG10E,
SQRT2, SQRT1_2.
// Basic
Math.abs(x) Math.floor(x) Math.ceil(x)
Math.round(x) Math.trunc(x) Math.sign(x)
Math.min(a, b) Math.max(a, b) Math.pow(x, y)
Math.sqrt(x) Math.cbrt(x) Math.hypot(a, b)
// Trigonometric
Math.sin(x) Math.cos(x) Math.tan(x)
Math.asin(x) Math.acos(x) Math.atan(x)
Math.atan2(y, x) Math.sinh(x) Math.cosh(x)
Math.tanh(x) Math.asinh(x) Math.acosh(x)
Math.atanh(x)
// Exponential and logarithmic
Math.log(x) Math.log10(x) Math.log2(x)
Math.log1p(x) Math.exp(x) Math.expm1(x)
// Other
Math.clz32(x) Math.imul(a, b) Math.fround(x)
Math.random() is intentionally unavailable. The
interpreter has no implicit time source and no implicit entropy
source. A host that needs randomness must provide it through an
explicit capability.
Array
// Instance methods
arr.length arr.push(item) arr.pop()
arr.shift() arr.unshift(item)
arr.map(fn) arr.filter(fn) arr.reduce(fn, init)
arr.forEach(fn) arr.find(fn) arr.findIndex(fn)
arr.some(fn) arr.every(fn) arr.includes(item)
arr.indexOf(item) arr.slice(start, end)
arr.concat(other) arr.join(sep) arr.reverse()
arr.sort(fn)
// Static methods
Array.isArray(x)
String
// Instance methods
str.length str.charAt(idx) str.charCodeAt(idx)
str.indexOf(sub) str.includes(sub) str.startsWith(sub)
str.endsWith(sub) str.slice(start, end)
str.split(sep) str.replace(from, to)
str.toUpperCase() str.toLowerCase() str.trim()
// Static methods
String.fromCharCode(code) String.fromCodePoint(code)
Object
Object.keys(obj) Object.values(obj) Object.entries(obj)
Object.assign(target, source)
Number
Constants: MAX_VALUE, MIN_VALUE,
MAX_SAFE_INTEGER, MIN_SAFE_INTEGER,
POSITIVE_INFINITY, NEGATIVE_INFINITY,
NaN, EPSILON.
Number.isNaN(x) Number.isFinite(x) Number.isInteger(x)
Number.parseInt(s) Number.parseFloat(s)
Global functions
parseInt(s) parseFloat(s) isNaN(x)
isFinite(x) Boolean(x) String(x)
Number(x)