• 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
  • Array.prototype[Symbol.unscopables]
      • Deutsch
      • Español
      • Français
      • 日本語
      • 한국어
      • Português (do Brasil)
      • Русский
      • 中文 (简体)

    In this article

    • Value
    • Description
    • Examples
    • Specifications
    • Browser compatibility
    • See also
    1. Array.from()
    2. Array[Symbol.species]
  • Instance methods
    1. Array.prototype.entries()
    2. Array.prototype.find()
    3. Array.prototype.flat()
    4. Array.prototype.indexOf()
    5. Array.prototype.map()
    6. Array.prototype.reduceRight()
    7. Array.prototype.some()
    8. Array.prototype.toReversed()
    9. Array.prototype.unshift()
    10. Array: length
    11. Function.prototype.bind()
    12. Function: displayName Non-standard
    13. Function.prototype.arguments Non-standard Deprecated
    14. Function.prototype.caller Non-standard Deprecated
  • Instance methods
    1. Object.prototype.__defineGetter__() Deprecated
    2. Object.prototype.__defineSetter__() Deprecated
    3. Object.prototype.__lookupGetter__() Deprecated
    4. Object.prototype.__lookupSetter__() Deprecated
    5. Object.prototype.toLocaleString()
    6. Object.prototype.__proto__ Deprecated
    7. null-prototype object with property names given below and their values set to true.

      Property attributes of Array.prototype[Symbol.unscopables]
      Writableno
      Enumerableno
      Configurableyes
  • Description

    The default Array properties that are ignored for with statement-binding purposes are:

    • at()
    • copyWithin()
    • entries()
    • fill()
    • find()
    • findIndex()
    • findLast()
    • findLastIndex()
    • flat()
    • flatMap()
    • includes()
    • keys()
    • toReversed()
    • toSorted()
    • toSpliced()
    • values()

    Array.prototype[Symbol.unscopables] is an empty object only containing all the above property names with the value true. Its toString won't accidentally be made unscopable, and a toString() within the with statement will continue to be called on the array.

    See Symbol.unscopables for how to set unscopable properties for your own objects.

    Examples

    Imagine the values.push('something') call below is in code that was written prior to ECMAScript 2015.

    js
    var values = [];
    
    with (values) {
      values.push("something");
    }
    

    When ECMAScript 2015 introduced the Array.prototype.values() method, the with statement in the above code started to interpret values as the values.values array method instead of the external values variable. The values.push('something') call would break because it's now accessing push on the values.values method. This caused a bug to be reported to Firefox (Firefox Bug 883914).

    So the [Symbol.unscopables] data property for Array.prototype causes the Array properties introduced in ECMAScript 2015 to be ignored for with statement-binding purposes — allowing code that was written prior to ECMAScript 2015 to continue working as expected, rather than breaking.

    Specifications

    Specification
    ECMAScript® 2026 Language Specification
    # sec-array.prototype-%symbol.unscopables%

    Browser compatibility

    See also

    • Polyfill of Array.prototype[Symbol.unscopables] in core-js
    • Indexed collections guide
    • Array
    • with
    • Symbol.unscopables

    Help improve MDN

    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