I got a library for you, also a really nice course of establishing mental models, and a gentle introduction to web components for you. Happy weekend!
Dinero.js lets you express monetary values in JavaScript. You can perform mutations, conversions, comparisons, format them extensively, and overall make money manipulation in your application easier and safer.