Skip to content

Commit b3cabcd

Browse files
committed
JavaSCript-II this.js commit
1 parent 48d4606 commit b3cabcd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/this.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,19 @@ const checkPassword = function comparePasswords(passwordToCompare) {
3535
// use `this` to access the object's `password` property.
3636
// do not modify this function's parameters
3737
// note that we use the `function` keyword and not `=>`
38+
39+
if (me.password === passwordToCompare) {
40+
return true;
41+
}
42+
return false;
3843
};
3944

4045
// invoke `checkPassword` on `me` by explicitly setting the `this` context
4146
// use .call, .apply, and .bind
4247

4348
// .call
44-
49+
checkPassword.call(me);
4550
// .apply
46-
51+
checkPassword.apply(me);
4752
// .bind
53+
const boundPassword = checkPassword.bind(me);

0 commit comments

Comments
 (0)