Skip to content

Mohammad Tourjoman - #1

Open
mtourj wants to merge 3 commits into
masterfrom
mohammad-tourjoman
Open

mtourj wants to merge 3 commits into
masterfrom
mohammad-tourjoman

Conversation

@mtourj

@mtourj mtourj commented May 8, 2019

Copy link
Copy Markdown
Owner

No description provided.

Mohammad Tourjoman added 2 commits May 8, 2019 14:20
@mtourj
mtourj requested a review from Ian84Be May 8, 2019 22:17

@Ian84Be Ian84Be left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

great job working through this project and programming logic for damage/destroy.

Comment thread assignments/prototypes.js
this.airstrike = function (target) {
console.log(`${this.name} launched an airstrike on ${target.name}!`);
this.healthPoints += 2;
return target.takeDamage(2);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

only 2 damage for an airstrike?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

the AI that fires the missiles is inaccurate 🤷‍♂

Comment thread assignments/prototypes.js
CharacterStats.prototype = Object.create(GameObject.prototype);

/* updated for stretch */
CharacterStats.prototype.takeDamage = function(damage) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

great job with the damage logic.

Comment thread assignments/this.js
* 4.
* 1. Window binding means that the 'this' keyword binds to the window object (also
known as default binding)
* 2. Implicit binding means that the 'this' keyword binds implicitly (automatically)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Implicit binding refers to the dot notaton. the object on the left of the dot is implicated as THIS.

obj.speak() obj is THIS

const obj = {
  name: 'steve',
  speak() {
    return `hello my name is ${this.name}`;
  }
}
obj.speak();

Comment thread assignments/this.js
}

console.log(testFunc.name);
var testFuncTest = new testFunc ();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you should only be using CONST and LET to declare variables. VAR is a relic and does not have the same helpful scoping rules that CONST and LET provide.
const testFuncTest = new TestFunc();

Comment thread assignments/this.js
// Principle 3

// code example for New Binding
function testFunc (){

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

by convention, Constructor functions are named with CapitalCase. this does not affect the way the code functions, but it provides a helpful visual cue to keep your code standardized and thereby easier for you to read.

function TestFunc() {

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