It looks like Arrays created with Object.create walk like Arrays and quack like Arrays, but are still not real arrays. At least with v8 / node.js.
> a = [
No, you cannot. Object.create
is all about prototypes, but both []
and Object.create(Array.prototype)
inherit from the same prototype object.
What you call "desired Object.prototype.toString behaviour" is the internal [[Class]]
of the object, which is impossible to set up with Object.create
. Creating "true arrays" (with an Array
class and special array behaviour - indexed properties, .length
) is only possible by using array literals or calling the Array constructor.
The short answer is no. This article explains it all in some detail.