DEV Community

Cover image for Easy use of MATH
Eckehard
Eckehard

Posted on

2

Easy use of MATH

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

Top comments (1)

Collapse
 
artydev profile image
artydev

Nice thank you Eckehard :-)

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more