Easy use of MATH
Eckehard

Eckehard @efpage

About: Always curious...

Location:
Germany
Joined:
May 24, 2021

Easy use of MATH

Publish Date: Oct 16 '23
1 1

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)
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

Comments 1 total

  • artydev
    artydevOct 16, 2023

    Nice thank you Eckehard :-)

Add comment