Yashotantra Academy
AI · Blockchain · Cloud · Data
Dark mode active
Learn
Tracks
ABCD
Certification
More
▾
Dark mode active
Learn
Tracks
ABCD
Certification
Study
Theory
Code Lab
Build
Solidity IDE
Staking Sandbox
Simulation
Reference
Wallets
Gas Fees
Explorers
← Code Lab
JavaScript
0/50 solved · 0%
All lessons
lesson
code
Patterns · medium
33. Immutable updates
Never mutate shared state.
Write `addTx(state, tx)` returning a new state object with `tx` appended to `state.txs`.
Required in your answer:
...s
txs:
Reveal solution
Run & check
Reset
Runs in a sandboxed worker
function addTx(state, tx) { // TODO }
Output appears here.
← 32. Module thinking
34. Higher-order functions →