Skip to content

Brandon Benefield: JavaScript-III - #24

Closed
bbenefield89 wants to merge 2 commits into
bloominstituteoftechnology:masterfrom
bbenefield89:master
Closed

Brandon Benefield: JavaScript-III#24
bbenefield89 wants to merge 2 commits into
bloominstituteoftechnology:masterfrom
bbenefield89:master

Conversation

@bbenefield89

Copy link
Copy Markdown

No description provided.

Comment thread assignments/prototypes.js
this.hp = myObj.hp
this.name = myObj.name
}
CharacterStats.prototype = Object.create(GameObject.prototype);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect use of the call and Object create combo. 💯

Comment thread assignments/prototypes.js

function Humanoid(myObj) {
CharacterStats.call(this, myObj)
this.faction = myObj.faction

@ghost ghost Apr 19, 2018

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this really can getcha, if you need semi-colons feel free to ask and I will lend you some. Worst case you find an error down the road that probably even tells you where an assignment went wrong...

// This is/should be valid javascript
let a, b, c;
a = b = c = 1;
// ===
a = b
c = 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this behavior does right itself when typed in the browser console. I wouldn't rely on it myself.

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

Successfully merging this pull request may close these issues.

2 participants