hack OOP

Run Settings
LanguageJavaScript
Language Version
Run Command
function Account(balance) { return function(message, args) { if (message === 'deposit') { balance += args[0]; } if (message === 'withdraw') { balance -= args[0]; } if (message === 'balance') { return balance; } }; } var myAccount = Account(42); console.log(myAccount('balance')); myAccount('deposit', [3]); console.log(myAccount('balance'));
Editor Settings
Theme
Key bindings
Full width
Lines