CoffeeScript in Action by Patrick Lee

CoffeeScript in Action by Patrick Lee

Author:Patrick Lee [Unknown]
Language: eng
Format: epub, pdf
Publisher: Manning Publications


Great, that’s a duck. Is instanceof the solution? No. What happens when you change the DuckRace constructor to admit any objects that are instanceof Duck?

class DuckRace constructor (applicants) -> @ducks = d for d in applicants when d instanceof Duck go: -> duck.walk() for duck in @ducks

The race is run. Unfortunately, one of the ducks isn’t really a duck. It was a duck, but it was turned into a snake by an evil warlock:

You tried to use a type to solve your problem (via the instanceof operator) and the result was a type error. Irony.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.