Skip to content

Decorator Pattern extend() #222

@iramirezc

Description

@iramirezc

Hi Addy,

I wonder why in this line of code

we are extending CaseDecorator with MacbookDecorator. As functions, they don't have any enumerable properties by their own yet. Shouldn't happen the extension in the prototype like:

extend(CaseDecorator.prototype, MacbookDecorator.prototype);

because trying to do this console.log(decoratedMacbookPro.addEngraving()); results in a TypeError: decoratedMacbookPro.addEngraving is not a function

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