Skip to content

Commit fe87ee5

Browse files
committed
fix lingering eslint errors 😡
1 parent 5828722 commit fe87ee5

3 files changed

Lines changed: 16 additions & 17 deletions

File tree

‎src/prototype.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function GameObject(options) {
5757
}
5858
GameObject.prototype.destroy = function () {
5959
return 'Game object was removed from the game.';
60-
}
60+
};
6161

6262
function NPC(options) {
6363
GameObject.call(this, options);
@@ -68,7 +68,7 @@ function NPC(options) {
6868
NPC.prototype = Object.create(GameObject.prototype);
6969
NPC.prototype.takeDamage = function () {
7070
return `${this.name} took damage.`;
71-
}
71+
};
7272

7373
function Humanoid(options) {
7474
NPC.call(this, options);
@@ -80,7 +80,7 @@ function Humanoid(options) {
8080
Humanoid.prototype = Object.create(NPC.prototype);
8181
Humanoid.prototype.greet = function () {
8282
return `${this.name} offers a greeting in ${this.language}.`;
83-
}
83+
};
8484

8585
// SOLUTION USING ES6 CLASSES & DESTRUCTURING:
8686

‎src/recursion.js‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,21 @@ const nFactorial = n => (
2323
* 4. else return true
2424
*/
2525
const checkMatchingLeaves = (obj) => {
26-
let result = [];
27-
28-
function _helper(obj) {
29-
Object.keys(obj).forEach(key => {
30-
if (typeof obj[key] === 'object') {
31-
_helper(obj[key]);
32-
}
33-
else result.push(obj[key]);
26+
const result = [];
27+
28+
function helper(innerObj) {
29+
Object.keys(innerObj).forEach((key) => {
30+
if (typeof innerObj[key] === 'object') helper(innerObj[key]);
31+
else result.push(innerObj[key]);
3432
});
3533
}
3634

37-
_helper(obj);
35+
helper(obj);
3836

39-
return !!result.reduce(function(a, b) {
40-
return (a === b)
37+
return !!result.reduce((a, b) => (
38+
a === b
4139
? a
42-
: false;
43-
});
40+
: false));
4441
};
4542

4643
/* eslint-enable no-unused-vars */

‎src/this.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const me = new User({
2727
const result = me.checkPassword('correcthorsebatterystaple'); // should return `true`
2828
console.log(result); // => true
2929

30+
31+
3032
/* part 2 */
3133

3234
const checkPassword = function comparePasswords(passwordToCompare) {
@@ -48,9 +50,9 @@ console.log(checkPassword.call(me, 'correcthorsebatterystaple')); // => true
4850
console.log(checkPassword.apply(me, ['correcthorsebatterystaple'])); // => true
4951

5052
// .bind
51-
5253
/* bind returns a function that we have to call with the argument later,
5354
* so to get this to work we have to assign the function it returns to
5455
* a value and then call that value, passing in the password to check: */
5556
const check = checkPassword.bind(me);
5657
console.log(check('correcthorsebatterystaple')); // => true
58+

0 commit comments

Comments
 (0)