Amazing that there isn’t a native js function for this as it’s asked for all the time…
But you can find one here: Javascript into mathematical functions - #3 by felgall
Amazing that there isn’t a native js function for this as it’s asked for all the time…
But you can find one here: Javascript into mathematical functions - #3 by felgall