# The Array.isArray shenanigans

**URL:** <https://es.discourse.group/t/the-array-isarray-shenanigans/1745>\
**Category:** Spec Reading\
**Tags:** proxy\
**Created:** [June 24, 2023, 12:39pm UTC](https://es.discourse.group/t/the-array-isarray-shenanigans/1745 "2023-06-24T12:39:26Z")\
**Posts on this page:** 3\
**Page:** 3

<div class="post-metadata">

**Author:** ![aclaymore](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aclaymore/32/501_2.png) [@aclaymore](https://es.discourse.group/u/aclaymore)\
**Post date:** [June 26, 2023, 10:16pm UTC](https://es.discourse.group/t/the-array-isarray-shenanigans/1745/41 "2023-06-26T22:16:58Z")

</div>

On the topic of adding a new meta object protocol hook for `isArray`, even if this was added it would likely need to have an invariant that it would always match the result of the target value. Similar to existing hooks like: [handler.isExtensible() - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/isExtensible#invariants)

This would prevent it being possible to create a value that could do odd things such as return `true` or `false` at random for `Array.isArray`

---

<div class="post-metadata">

**Author:** ![WebReflection](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/webreflection/32/248_2.png) [@WebReflection](https://es.discourse.group/u/WebReflection)\
**Post date:** [July 7, 2023, 11:19am UTC](https://es.discourse.group/t/the-array-isarray-shenanigans/1745/42 "2023-07-07T11:19:43Z")

</div>

> [@aclaymore](#):
>
> Does this not apply also to the use of `Proxy`, `WeakMap` etc? To be able to trust any of these APIs you need to be the code that runs first and capture references to them and then only use those references.

please tell me something I haven't published already ... the point is that at its core there's no trap ... if there was, it doesn't matter who patched what, the native `Array.isArray(proxy)` will produce what the native Proxy trap returns ... avoid all that and good luck with the code, but that's not interesting to me, me being forced by this thread to monkey-patch `Array.isArray` is the concern ... but it works like a charm, so I've moved forward weeks ago with zero regrets.

About `isExtensible()` I am afraid I have no interest in discussing off topic issues here, thanks for not diverging from what's being discussed in here: `Array.isArray` missing trap, which is not a trap that already exist neither.

---

<div class="post-metadata">

**Author:** ![WebReflection](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/webreflection/32/248_2.png) [@WebReflection](https://es.discourse.group/u/WebReflection)\
**Post date:** [November 17, 2023, 2:43pm UTC](https://es.discourse.group/t/the-array-isarray-shenanigans/1745/43 "2023-11-17T14:43:31Z")

</div>

to whom it might concern, or simply end up in here due similar issues, there's more to this story as `ownKeys` is also affected by proxy drilling down its value [Proxy drilling once again ...](https://es.discourse.group/t/proxy-drilling-once-again/1850)

[Previous page](https://es.discourse.group/t/the-array-isarray-shenanigans/1745.md?page=2)
