// Follow the instructions and fill in the blank sections. // There are no tests for this file. // To verify your code works you can run this file using `node this.js` while in the `/src` folder /* eslint-disable no-useless-constructor, no-unused-vars */ class User { constructor(options) { this.username = options.username; this.password = options.password; // set a username and password property on the user object that is created } checkPassword(passwordToCompare) { return this.password === passwordToCompare; } // create a method on the User class called `checkPassword` // this method should take in a string and compare it to the object's password property // return `true` if they match, otherwise return `false` } /* eslint-enable no-useless-constructor */ const me = new User({ username: 'LambdaSchool', password: 'correcthorsebatterystaple' }); const result = me.checkPassword('correcthorsebatterystaple'); // should return `true` const checkPassword = function comparePasswords(passwordToCompare) { return this.password === passwordToCompare; // recreate the `checkPassword` method that you made on the `User` class // use `this` to access the object's `password` property. // do not modify this function's parameters // note that we use the `function` keyword and not `=>` }; /* eslint-enable no-unused-vars */ // invoke `checkPassword` on `me` by explicitly setting the `this` context // use .call, .apply, and .bind // .call checkPassword.call(me, 'correcthorsebatterystaple'); // .apply checkPassword.apply(me, 'correcthorsebatterystaple'); // .bind const boundPasswordCheck = checkPassword.bind(me); boundPasswordCheck('correcthorsebatterystaple');