O'Reilly logo
  • Karl Giesing thinks this is interesting:

XYZ = Object.create( Task );

From

Cover of You Don't Know JS: this & Object Prototypes

Note

Again: The main (only) reason you want to do this is to provide polymorphism. Consumers of XYZ would be expected to call XYZ.setID() and XYZ.outputID(). Consumers would NOT be expected to call XYZ.prepareTask() because they wouldn't know they're being passed an object with this behavior; they'll assume that they're being passed an object with Task's behavior.