cf.completefrontend

Predict the outputEasy

What do these two wallets created by the same factory log?

What does this log?
function createWallet() {
  let balance = 0;
  return {
    add(amount) {
      balance += amount;
      return balance;
    },
    get() {
      return balance;
    },
  };
}
 
const mine = createWallet();
const yours = createWallet();
mine.add(10);
yours.add(5);
mine.add(1);
console.log(mine.get(), yours.get());
console.log(mine.balance);

The answer

Work out every line it logs, in order. Then check.

Checking your sign-in…