-
Notifications
You must be signed in to change notification settings - Fork 11
First attempt at inheritance homework. #3
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
21a7564
7e5daf1
75fcdfe
6f7c2f7
daa7404
cd1b8ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| node_modules/ | ||
| .idea/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,14 +13,35 @@ export function doubleXTimes ( x, num ) { | |
| return result; | ||
| } | ||
|
|
||
| export function doubleEach ( arr ) { | ||
| let result = arr.map( double ); | ||
| export const doubleEach = x => x.map(double); | ||
|
|
||
| // const result = arr.map( x => double( x ) ); | ||
| // const result = arr.map( function ( x ) { | ||
| // return double( x ); | ||
| // }); | ||
| export function Animal() { | ||
| this.clorophyll = false; | ||
| } | ||
| Animal.SOUND = 'generic sound'; | ||
| Animal.prototype.speak = function () {return this.constructor.SOUND}; | ||
|
|
||
| return result; | ||
| export function Reptile() { | ||
| this.scales = true; | ||
| } | ||
|
|
||
| Reptile.SOUND = 'Roar'; | ||
| Reptile.prototype = new Animal(); | ||
| Reptile.prototype.constructor = Reptile; | ||
|
|
||
| export function Primate() { | ||
| this.thumbs = true; | ||
|
||
| } | ||
| Primate.SOUND = 'Ooh ooh eee!'; | ||
| Primate.prototype = new Animal(); | ||
|
||
| Primate.prototype.constructor = Primate; | ||
|
|
||
| export function Human() { | ||
| this.sentience = true; | ||
| } | ||
| Human.SOUND = 'hello'; | ||
| Human.prototype = new Primate(); | ||
| Human.prototype.constructor = Human; | ||
|
|
||
|
|
||
|
|
||
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.
<random-thought>Random comment having nothing to do with this class nor even javascript: you can define a global
gitignorefile that applies to all repositories, which is a good place for stuff like this. I do it that way so I can omit files that my editor generates without (a) having to change every gitignore in every repo I ever touch; and (b) to prevent committing irrelevant code to repos.</random-thought>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.
I didn't know you could define a global .gitignore across repositories as I mostly just write them per-project. Are you simply just keeping the configurations in a common repository or are you doing any special Github linking between projects?
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.
No, it's more "set it and forget it". Check out the link from my first comment. You just keep a file on your computer someplace that looks like a gitignore file and you put its location in your configuration for git (can be done from cli too).