Easy use of MATH
Eckehard
Posted on October 16, 2023
Javascript provides a complete set of Math-Functions throuth the builtin Math-object. The properties and functions are used like this:
let A = Math.sin(45.0/Math.PI)
Did you ever wonder if there is an easier way to use Math-functions? This is an easy trick to simplify the usage through destructuring:
const { trunc, floor, abs, log10, min, max, sin, PI } = Math
let A = sin(45.0/PI)
💖 💪 🙅 🚩
Eckehard
Posted on October 16, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.