Questions about Javascript documentation

HI,
At this page

The first table:
Property attributes of Array.prototype
Writable no
Enumerable no
Configurable no
What’s mean: the true value at no?
Thanks

If I understand your question, you want to know what Writable, Enumerable, and Configurable mean.

From: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty

configurable
true if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
Defaults to false.

enumerable
true if and only if this property shows up during enumeration of the properties on the corresponding object.
Defaults to false.

writable
true if and only if the value associated with the property may be changed with an assignment operator.
Defaults to false.


So the documentation you cited is saying that Array.prototype is not:

writable

console.log(Array.prototype) // [] Array.prototype = 'something' console.log(Array.prototype) // [] // notice we didn't change the value of Array.prototype; it isn't writable

Enumerable

// enumerating properties of Array for (var property in Array) { console.log(property) } // nothing will be printed, indicating that Array doesn't have any enumerable properties

Configurable

console.log(Array.prototype) // [] delete(Array.prototype) // false console.log(Array.prototype) // [] // we couldn't delete it; it's not configurable

2 Likes