Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add Concept Exercise: Windowing System (Classes) #1476
Add Concept Exercise: Windowing System (Classes) #1476
Changes from all commits
62e74a2
ba2a7e9
1d9ceaf
94ff82a
e0df2d6
4a25011
aaf98fa
5b841c0
80fe83c
5370574
7eb1d92
339a6b1
f8601e8
d2ba78a
48d58b3
e7bf39a
4150e3c
00dae46
c9a8936
73e50a5
7607b5e
1886337
c0920d7
b02ebe8
3d7fee1
3c54f49
e68b48f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it is helpful to show how this is constructed under the hood as an object:
this
removes the need to explicitly set the object and return it. Might be overkill or not needed :-)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the student might not know about
Object.create
at this point, I felt this code is more confusing then helping. Imo the important part is that you don't have to explicitly returnthis
and that is covered in the text above.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great @junedev. This concept looks awesome and enjoyed reading the code when reviewing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(fun fact, returning a new object from the constructor function is in fact a way to get closures/private variables and private functions from a constructor, however, you need to set the prototype at
Object.create
if you want to keep inheritance to work)