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
Numbers · medium
37. formatUnits by hand
Convert wei to a human string.
Write `formatUnits(weiString, decimals)` returning a decimal string with no trailing zeros (e.g. `"1.5"`).
Required in your answer:
BigInt
padStart
Reveal solution
Run & check
Reset
Runs in a sandboxed worker
function formatUnits(weiString, decimals) { // TODO }
Output appears here.
← 36. BigInt for wei
38. Generators →