RPG Bank

Hi so i’m trying to make a rpg game out of JavaScript i’ve done the battle system, now onto the bank. I haven’t done all the features like a withdraw button and some other stuff. The thing is when i put a value in it, it adds up my total money but the object property doesn’t change permanently. When i log player.credits on to the console it stays at 5000 credits. Can anyone help me? Been on this on and off since i got up lol.

Deposit

let player = {
credits: 5000,
bankCredits: 100,
bank () {
let hope = player.credits;
let a = parseInt(document.getElementById(‘money’).value);
player.credits = hope + a;

  document.getElementById('move').innerHTML = 'You have depostied ' + a + ' and now have ' + player.credits; 

}
};

console.log(player.credits)

sorry but cant get the html to work though, its not appearing…

Hi, I know you posted this a while ago so you might have solved it already!

You need some way to call the bank method on your player object:

player.bank()

I don’t have any html involved but if I run this code:

let player = {
	credits: 5000,
	bankCredits: 100,
	bank () {
		let hope = player.credits;
		let a = 15;
		player.credits = hope + a;
	}
};

player.bank();

console.log(player.credits);

it logs 5015.

Hope this helps