I am looking for an effective way to cut floating-point numbers in Javascript that are long. I need this because my conclusion to get the percentage of two numbers can sometimes be like 99.4444444, while I'm only interested in the first 2 digits after the "." such as 99.44
My current percentage for two numbers:
function takePercentage(x,y){
return (x /y) * 100;
}
source
share