This is the latest docs version
Quick Links
  • -Overview
  • -Language Features
  • -JS Interop
  • -Build System
Documentation
Language Manual
Reference for all language features
ReScript & React
First class bindings for ReactJS
GenType
Seamless TypeScript integration
Reanalyze
Dead Code & Termination analysis
Exploration
Packages
Explore third party libraries and bindings
Syntax Lookup
Discover all syntax constructs
APIPlaygroundBlogCommunity
  • Playground
  • Blog
  • Community
  • X
  • Bluesky
  • GitHub
  • Forum
Js Module
Overview
Js
submodules
  • Array
  • Array2
  • BigInt
    • v
      fromStringExn
    • v
      ~-
    • v
      ~+
    • v
      +
    • v
      -
    • v
      *
    • v
      /
    • v
      mod
    • v
      **
    • v
      land
    • v
      lor
    • v
      lxor
    • v
      lnot
    • v
      lsl
    • v
      asr
    • v
      toString
    • v
      toLocaleString
  • Blob
  • Console
  • Date
  • Dict
  • Exn
  • File
  • Float
  • Global
  • Int
  • Json
    • Kind
  • List
  • Map
  • Math
  • Null
  • Null_undefined
  • Nullable
  • Obj
  • Option
  • Promise
  • Promise2
  • Re
  • Result
  • Set
  • String
  • String2
  • TypedArray2
    • DataView
    • Float64Array
    • Float32Array
    • Uint32Array
    • Int32Array
    • Uint16Array
    • Int16Array
    • Uint8ClampedArray
    • Uint8Array
    • Int8Array
    • ArrayBuffer
    Typed_array
    • DataView
    • Float64_array
    • Float64Array
    • Float32_array
    • Float32Array
    • Uint32Array
    • Int32_array
    • Int32Array
    • Uint16Array
    • Int16Array
    • Uint8ClampedArray
    • Uint8Array
    • Int8Array
    • S
    • ArrayBuffer
    • Type
  • Types
  • Undefined
  • Vector
  • WeakMap
  • WeakSet
  • API / Js / Bigint

    BigInt

    JavaScript BigInt API

    fromStringExn

    RESCRIPT
    let fromStringExn: string => bigint

    Parses the given string into a bigint using JavaScript semantics. Return the number as a bigint if successfully parsed. Uncaught syntax exception otherwise.

    Examples

    RESCRIPT
    /* returns 123n */ Js.BigInt.fromStringExn("123") /* returns 0n */ Js.BigInt.fromStringExn("") /* returns 17n */ Js.BigInt.fromStringExn("0x11") /* returns 3n */ Js.BigInt.fromStringExn("0b11") /* returns 9n */ Js.BigInt.fromStringExn("0o11") /* catch exception */ try { Js.BigInt.fromStringExn("a") } catch { | _ => ... }

    ~-

    RESCRIPT
    let ~-: bigint => bigint

    ~+

    RESCRIPT
    let ~+: bigint => bigint

    +

    RESCRIPT
    let +: (bigint, bigint) => bigint

    -

    RESCRIPT
    let -: (bigint, bigint) => bigint

    *

    RESCRIPT
    let *: (bigint, bigint) => bigint

    /

    RESCRIPT
    let /: (bigint, bigint) => bigint

    mod

    RESCRIPT
    let mod: (bigint, bigint) => bigint

    **

    RESCRIPT
    let **: (bigint, bigint) => bigint

    land

    RESCRIPT
    let land: (bigint, bigint) => bigint

    lor

    RESCRIPT
    let lor: (bigint, bigint) => bigint

    lxor

    RESCRIPT
    let lxor: (bigint, bigint) => bigint

    lnot

    RESCRIPT
    let lnot: bigint => bigint

    lsl

    RESCRIPT
    let lsl: (bigint, bigint) => bigint

    asr

    RESCRIPT
    let asr: (bigint, bigint) => bigint

    toString

    RESCRIPT
    let toString: bigint => string

    Formats a bigint as a string. Return a string representing the given value. See toString on MDN.

    Examples

    RESCRIPT
    /* prints "123" */ Js.BigInt.toString(123n)->Js.log

    toLocaleString

    RESCRIPT
    let toLocaleString: bigint => string

    Returns a string with a language-sensitive representation of this BigInt value.

    Examples

    RESCRIPT
    /* prints "123" */ Js.BigInt.toString(123n)->Js.log
    Types and values
    • v
      fromStringExn
    • v
      ~-
    • v
      ~+
    • v
      +
    • v
      -
    • v
      *
    • v
      /
    • v
      mod
    • v
      **
    • v
      land
    • v
      lor
    • v
      lxor
    • v
      lnot
    • v
      lsl
    • v
      asr
    • v
      toString
    • v
      toLocaleString

    © 2025 The ReScript Project

    Software and assets distribution powered by KeyCDN.

    About
    • Community
    • ReScript Association
    Find us on