-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Differences in object construction #51
Comments
I think the only documentation is in the source code: tl;dr |
That makes sense why copyProperties must be called with "new". Any reason Anyway, this differece would be worth a comment in the code, or if there is no difference, then one technique should be picked. |
|
@fisherwebdev @zpao A related question is this declaration in ThreadSection.react.js, line 21
I'm wondering if there was a reason that it was not declared like:
|
Because we wanted to. In general we prefer that style and it does have semantic differences in JS. Here's a deeper dive into the differences: http://javascriptweblog.wordpress.com/2010/07/06/function-declarations-vs-function-expressions/. There are times where your latter example is appropriate. |
@zpao Very helpful article for a reforming CoffeeScripter-Rails-I-don't-use-modules-nor-Javascript developer! Do you have a link to any style guidelines, especially one that has some "whys"? |
https://github.com/airbnb/javascript is quite good from what I remember but it's been a while since I looked closely. |
Any information on why the difference between:
and
Maybe we don't want to call the constructor of EventEmitter? It doesn't seem to do much either way.
It would be nice to simplify the setup.
The text was updated successfully, but these errors were encountered: