pav
5/28/2013 - 6:19 PM

Now, let's say you're an attacker that really doesn't like Jones. You want to change the amount of money in Jones' bank account from $1,000,

Now, let's say you're an attacker that really doesn't like Jones. You want to change the amount of money in Jones' bank account from $1,000,000 to $5.

function BankAccount( lastname ) {
    this.lastname = lastname;
    this.balance = 1000000;    
}

// write your function here
function attackBalance(account){
    account.balance = 5;    

}

var jonesBankAccount = new BankAccount ("Jones");

console.log("jonesBankAccount has " + jonesBankAccount.balance + " dollars!");
attackBalance(jonesBankAccount);
console.log("After attack, jonesBankAccount has " + jonesBankAccount.balance + " dollars!");