alexlucas83
3/18/2019 - 4:55 PM

POO js2

const assert = require('assert');
class BankCustomer {
    constructor(name,code){
    this.name = name;
    this.code = code;
    }
    getName(){
        return this.name;
    }
    verifyPinInput(){
        if(this.code === '3579'){
            return true;
        }else{
            return false;
        }
    }
}

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()}`);