JS Built-ins
← Array31 / 226
ArrayArray.ofintermediate

Array.of() β€” verify deep equality

πŸ“– Usage Example
const arr = Array.of(10, 20, 30)
Array.isArray(arr)  // β†’ true
arr.length          // β†’ 3

Array.of() always produces a real Array instance, verifiable with Array.isArray().

Array.of() β€” deep equality check

Array.of() produces a plain array. You can verify this with Array.isArray and compare its contents with .every() to confirm each element matches the expected value.

Challenge: Implement verifyOf that creates Array.of(5, 10, 15) and returns true if it deep-equals [5, 10, 15].

verifyOf() // β†’ true
πŸ’‘ Hints (2)
  • β€’ Use `.every((v, i) => v === expected[i])` to compare element-by-element.
  • β€’ `Array.of` always returns a plain Array, so `.toEqual` works directly on it.