#14767 closed bug (notabug)
isArray returns false for the new typed arrays
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 2.1.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I would expect $.isArray to return true for the new typed array objects - eg Float32Array and Int16Array, etc. In actual fact, all return false:
$.isArray(new Array(1)); true $.isArray(new Float32Array(1)); false $.isArray(new Float64Array(1)); false $.isArray(new Int8Array(1)); false $.isArray(new Int16Array(1)); false $.isArray(new Int32Array(1)); false
However, it might be deliberate behaviour to return false, because typed arrays don't support all the same functions as standard arrays - eg push, pop, map etc. If so, this behaviour should be documented.
Change History (2)
comment:1 Changed 9 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 9 years ago by
I suggest not changing this, if those new types doesn't implement all expected properties/methods from Array
This is definitely a docs issue,
isArray
is primarily for our internal needs and we have no need/desire to consume any of those arrayish types. Please open a ticket in the docs repo, as described in the page you passed through: http://bugs.jquery.com