3 ms·
* Yes createNew is not very optimal, in practice this is not really an issue though. Furthermore I value maintainability over performance. * They share the sam
by gabordemooij 15y ago
* Yes createNew is not very optimal, in practice this is not really an issue though. Furthermore I value maintainability over performance.
* They share the same object, so it's not composition. Does it really matter that it is not 'pure' inheritance?
* createNew() - bad code? why? just an opinion.
* I have written JS apps from day 1. And yes I know how to handle this,new and prototype. Still, I choose no longer to.
* obj.new() can be confused with new obj(); That's why I have chosen a more distinctive method name; createNew.
- stephenr 15y ago> I have written JS apps from day 1. And yes I know how to handle this,new and prototype. Still, I choose no longer to And yet you claim: > I dont use new, prototype and this because I find them confusing > obj.new() can be confused with new obj(); That's why I have chosen a more distinctive method name; createNew Also, "dog" can be confused with "do", and "ford" confused with "for" - i can't count how many time's i've got syntax errors because my dog loop of nested ford loops just kept outputting "dogs can't drive, stupid" to the console.
- justncase80 15y ago"new" is more minimal than "createNew" so I think it would be technically more minimal to use "new". Just sayin'.