Skip to content

Commit 115dfbd

Browse files
committed
Fix bug: selecting wrong command
1 parent 4269c0c commit 115dfbd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

JavaScript/5-undo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Bank {
6060
undo(count) {
6161
for (let i = 0; i < count; i++) {
6262
const command = this.commands.pop();
63-
const operation = command.amount < 0 ? 'Withdraw' : 'Income';
63+
const { operation } = command;
6464
const { undo } = operations[operation];
6565
undo(command);
6666
}

0 commit comments

Comments
 (0)