Skip to content

Commit b460dbe

Browse files
committed
Refactored class.js and eliminated error. error still exists on this.js
1 parent 7e5eb08 commit b460dbe

4 files changed

Lines changed: 34 additions & 24 deletions

File tree

‎src/class.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Cat extends Animal {
5151
this.name = catOptions.name;
5252
}
5353
meow() {
54-
return ${this.name} ' meowed!';
54+
return `${this.name} meowed!`;
5555
}
5656
}
5757

‎src/prototype.js‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,29 @@
4949
hamsterHuey.destroy(); // returns 'Game object was removed from the game.'
5050
*/
5151

52+
// class GameObject {
53+
// constructor (attributes){
54+
// this.createdAt = attributes.createdAt;
55+
// this.dimensions = attributes.dimensions;
56+
// }
57+
58+
// destroy() {
59+
// return 'Game object was removed from the game.';
60+
// }
61+
// }
62+
63+
// class NPC {
64+
// constructor(attributes) {
65+
// this.faction = attributes.faction;
66+
// this.weapons = attributes.weapons;
67+
// this.language = attributes.language;
68+
// }
69+
70+
// greet() {
71+
// return '$'
72+
// }
73+
// }
74+
5275
/* eslint-disable no-undef */
5376

5477
module.exports = {

‎src/this.js‎

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ class User {
1616
const me = new User({
1717
username: 'LambdaSchool',
1818
password: 'correcthorsebatterystaple',
19-
checkPassword(passwordToCompare) {
20-
return this.password === passwordToCompare;
21-
}
22-
}
23-
19+
checkPassword(altPassword) {
20+
return this.password === altPassword;
21+
},
22+
});
2423

2524
const result = me.checkPassword('correcthorsebatterystaple'); // should return `true`
2625

@@ -35,7 +34,8 @@ const checkPassword = function comparePasswords(passwordToCompare) {
3534
// invoke `checkPassword` on `me` by explicitly setting the `this` context
3635
// use .call, .apply, and .bind
3736

38-
checkPassword(passwordToCompare){
37+
const checkPassword = function
38+
checkPassword(passwordToCompare) {
3939
return this.password === passwordToCompare;
4040
}
4141

@@ -44,27 +44,14 @@ checkPassword(passwordToCompare){
4444
const me = new User({
4545
username: 'LambdaSchool',
4646
password: 'correcthorsebatterystaple',
47-
)};
48-
};
47+
});
4948

5049
checkPassword.call(me);
5150

5251
// .apply
5352

54-
const me = new User({
55-
username: 'LambdaSchool',
56-
password: 'correcthorsebatterystaple',
57-
)};
58-
};
59-
6053
checkPassword.apply(me);
6154

6255
// .bind
6356

64-
const me = new User({
65-
username: 'LambdaSchool',
66-
password: 'correcthorsebatterystaple',
67-
)};
68-
};
69-
70-
var newCheckPassword.bind(me);
57+
const checkPasswordOne = checkPassword.bind(me);

‎yarn-error.log‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Arguments:
2-
/usr/local/bin/node /usr/local/Cellar/yarn/1.5.1_1/libexec/bin/yarn.js test class.test.js
2+
/usr/local/bin/node /usr/local/Cellar/yarn/1.5.1_1/libexec/bin/yarn.js test this.test.js
33

44
PATH:
55
/Users/ericandrade/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
@@ -55,7 +55,7 @@ Trace:
5555
Error: Command failed.
5656
Exit code: 1
5757
Command: sh
58-
Arguments: -c eslint tests/*.test.js && eslint src/*.js && jest --verbose class.test.js
58+
Arguments: -c eslint tests/*.test.js && eslint src/*.js && jest --verbose this.test.js
5959
Directory: /Users/ericandrade/Desktop/JavaScript-II
6060
Output:
6161

0 commit comments

Comments
 (0)