Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"constructor tip" references? #60

Open
perguth opened this issue Sep 10, 2015 · 1 comment
Open

"constructor tip" references? #60

perguth opened this issue Sep 10, 2015 · 1 comment

Comments

@perguth
Copy link

perguth commented Sep 10, 2015

At least I would like to read more on that topic touched upon in the constructor tip in the reusable compontens section.

@emilbayes
Copy link
Member

It's to do with checking that the context, this, is an instance of the object Widget, ie. called with new. You can read more about what the new keyword does here 😄 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new

Another point worth noting is that if nothing is returned for the constructor, the newly created object is returned. This means you can freely choose to return something else if you want to. However this is rarely seen, but applicable in some special cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants