9 Matching Annotations
  1. Dec 2021
    1. function intersperse<T>(this: T[], mkT: (ix: number) => T): T[] { return this.reduce((acc: T[], d, ix) => [...acc, mkT(ix), d], []).slice(1); }
  2. Sep 2021
  3. Mar 2021
    1. An array is from a logical point of view not an object - although JavaScript handles and reports them as such. In practice however, it is not helpful to see them equal, because they are not.
    2. Arrays are definitely objects. Not sure why you think objects can't have a length property nor methods like push, Object.create(Array.prototype) is a trivial counterexample of a non-array object which has these. What makes arrays special is that they are exotic objects with a custom [[DefineOwnProperty]] essential internal method, but they are still objects.
  4. Sep 2020