Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const assert = require('assert');
- class BankCustomer {
- constructor (customerName, secretCode) {
- let myName = customerName;
- let mySecretCode = secretCode ;
- this.getSecretCode = () => mySecretCode;
- this.getMyName = () => myName;
- };
- getName () {
- return this.getMyName();
- };
- verifyPinInput(pin) {
- return pin == this.getSecretCode();
- }
- }
- const customer = new BankCustomer('John Doe', '3579');
- assert.equal(typeof customer.getName, 'function');
- assert.equal(typeof customer.verifyPinInput, 'function');
- assert.equal(customer.getName(), 'John Doe');
- assert.ok(customer.verifyPinInput('3579'));
- console.log(customer.verifyPinInput('3579') ?
- 'Yay! Money incoming !' :
- `Wrong password for ${customer.getName()}` );
- console.log(customer.getName());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement