• Skip to main content
  • Skip to search
  • Skip to select language
HTML

Structure of content on the web

  • Web APIs

    Interfaces for building web applications

  • Learn
    • CSS

      Learn to style content using CSS

    • Overview

      A customized MDN experience

    • FAQ

      Frequently asked questions about MDN Plus

  • HTTP Observatory

    Scan a website for free

  • JavaScript
  • valueOf()
      • Deutsch
      • Français
      • 日本語
      • 한국어
      • Português (do Brasil)
      • Русский
      • 中文 (简体)

    In this article

    • Try it
    • Syntax
    • Description
    • Examples
    • Specifications
    • Browser compatibility
    • See also
    1. toString()
    2. bind()
    3. displayName Non-standard
    4. arguments Non-standard Deprecated
    5. caller Non-standard Deprecated
  • Instance methods
    1. __defineGetter__() Deprecated
    2. __defineSetter__() Deprecated
    3. __lookupGetter__() Deprecated
    4. __lookupSetter__() Deprecated
    5. toLocaleString()
    6. __proto__ Deprecated
    7. Boolean values returns the primitive value of a Boolean object.

  • Try it

    const x = new Boolean();
    
    console.log(x.valueOf());
    / Expected output: false
    
    const y = new Boolean("Mozilla");
    
    console.log(y.valueOf());
    / Expected output: true
    

    Syntax

    js
    valueOf()
    

    Parameters

    None.

    Return value

    The primitive value of the given Boolean returns the primitive value of a Boolean object or literal Boolean as a Boolean data type.

    This method is usually called internally by JavaScript and not explicitly in code.

    Examples

    Using valueOf()

    js
    const x = new Boolean();
    const myVar = x.valueOf(); / assigns false to myVar
    

    Specifications

    Specification
    ECMAScript® 2026 Language Specification
    # sec-boolean.prototype.valueof

    Browser compatibility

    See also

    • Object.prototype.valueOf()

    Help improve MDN

    <script> element. JavaScript has changed over many years. This feature represents the oldest language features, such as built-in objects, statements, and operators. Also known as ECMAScript.","name":"JavaScript (initial core language support)"}},"browserCompat":["javascript.builtins.Boolean.valueOf"],"pageType":"javascript-instance-method"}}

    Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

    Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant