JavaScript Format Number as Currency (£ GBP Examples)
Turn 1234.5 into £1,234.50 with Intl.NumberFormat: commas, no symbol, whole pounds, accounting negatives, other currencies, and why to add money in pence.
Notes
Security notes, SOC lab write-ups and tested code by Mahir Faysal, a SOC Level 1 cybersecurity learner in Bangladesh, plus notes from my Next.js and Gemini projects. Sample posts are marked and drafts stay in the admin area.
Turn 1234.5 into £1,234.50 with Intl.NumberFormat: commas, no symbol, whole pounds, accounting negatives, other currencies, and why to add money in pence.
Format any JavaScript date as dd/mm/yyyy with a five-line function or toLocaleDateString('en-GB'), plus time zones, parsing UK dates and the month-0 trap.
Count and add working days in JavaScript with UTC dates, skip weekends and UK bank holidays from gov.uk's JSON, and avoid the clocks-change bug.
Work out a First, 2:1 or 2:2 from module marks: credit-weighted averages, 30:70 or 1:2 year weightings, rounding at 69.5 and the mark you need.
How UK student loan repayments are worked out in 2026/27: per-period thresholds, 9% over, rounding down, two plans at once and a floating-point trap.
A simple email regex for JavaScript forms, compared with a strict pattern and the browser's own check on ten addresses, plus a regex that froze for 1.5s.
0%