Skip to main content
Adds a ES2020 Reference / confirms that the answer is still relevant
Source Link

No.

The spec for the length property says:

The length property of this Array object is a data property whose value is always numerically greater than the name of every deletable property whose name is an array index.

There cannot be -1 properties.

Also, and more explicitly, the spec for Array says:

Every Array object has a length property whose value is always a nonnegative integer less than 232.

Update: Answer still holds for ES2020

No.

The spec for the length property says:

The length property of this Array object is a data property whose value is always numerically greater than the name of every deletable property whose name is an array index.

There cannot be -1 properties.

Also, and more explicitly, the spec for Array says:

Every Array object has a length property whose value is always a nonnegative integer less than 232.

No.

The spec for the length property says:

The length property of this Array object is a data property whose value is always numerically greater than the name of every deletable property whose name is an array index.

There cannot be -1 properties.

Also, and more explicitly, the spec for Array says:

Every Array object has a length property whose value is always a nonnegative integer less than 232.

Update: Answer still holds for ES2020

added 273 characters in body
Source Link
josh3736
  • 146.1k
  • 34
  • 227
  • 273

No.

The spec for the length property says:

The length property of this Array object is a data property whose value is always numerically greater than the name of every deletable property whose name is an array index.

There cannot be -1 properties.

Also, and more explicitly, the spec for Array says:

Every Array object has a length property whose value is always a nonnegative integer less than 232.

No.

The spec says:

The length property of this Array object is a data property whose value is always numerically greater than the name of every deletable property whose name is an array index.

There cannot be -1 properties.

No.

The spec for the length property says:

The length property of this Array object is a data property whose value is always numerically greater than the name of every deletable property whose name is an array index.

There cannot be -1 properties.

Also, and more explicitly, the spec for Array says:

Every Array object has a length property whose value is always a nonnegative integer less than 232.

Source Link
josh3736
  • 146.1k
  • 34
  • 227
  • 273

No.

The spec says:

The length property of this Array object is a data property whose value is always numerically greater than the name of every deletable property whose name is an array index.

There cannot be -1 properties.