Repository navigation
Conversation
Ian84Be
left a comment
There was a problem hiding this comment.
great job working through this project and programming logic for damage/destroy.
| this.airstrike = function (target) { | ||
| console.log(`${this.name} launched an airstrike on ${target.name}!`); | ||
| this.healthPoints += 2; | ||
| return target.takeDamage(2); |
There was a problem hiding this comment.
only 2 damage for an airstrike?
There was a problem hiding this comment.
the AI that fires the missiles is inaccurate 🤷♂
| CharacterStats.prototype = Object.create(GameObject.prototype); | ||
|
|
||
| /* updated for stretch */ | ||
| CharacterStats.prototype.takeDamage = function(damage) { |
There was a problem hiding this comment.
great job with the damage logic.
| * 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) |
There was a problem hiding this comment.
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();
| } | ||
|
|
||
| console.log(testFunc.name); | ||
| var testFuncTest = new testFunc (); |
There was a problem hiding this comment.
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();
| // Principle 3 | ||
|
|
||
| // code example for New Binding | ||
| function testFunc (){ |
There was a problem hiding this comment.
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() {
No description provided.