On this page
  1. Global.parseInt
  2. Signature & Overview
  3. Notes & Pitfalls
  4. Example

Global.parseInt

Prev: Number_isNaN | Up: Global | Next: encodeURIComponent
Rel: Global, JS Core Syntax & Types
Ref: MDN Web Docs — Global.parseInt
Tags: #public #web #javascript #builtins #global #tier/core


Signature & Overview

Number.parseInt(string, radix)

Parses a leading integer in the given radix (always pass 10 explicitly!).

Notes & Pitfalls

Example

console.assert(Number.parseInt("42", 10) === 42);
console.assert(Number.parseInt("ff", 16) === 255);
console.assert(Number.parseInt("12px", 10) === 12);

Linked from

Related notes