Skip to content
This repository was archived by the owner on Dec 17, 2018. It is now read-only.
This repository was archived by the owner on Dec 17, 2018. It is now read-only.

Replace _new with smart use of bind #62

@daurnimator

Description

@daurnimator

bind is more powerful than I knew. It changes not just 'this' but also optionally prepends args.
new Array(1,2,3) can also be expressed as new (Function.prototype.bind.call(Array,null,1,2,3))(), and hence also new (Function.prototype.bind.apply(Array,[null].concat([1,2,3]))) or even just new (Function.prototype.bind.apply(Array,[null,1,2,3]));.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions