how to turn decimales into percents with javascript 1

how to turn decimales into percents with javascript

var obtained = 475;var total = 500;var percent = obtained*100/total;console.log(percent); // 95.0

Here is what the above code is Doing:
1. We have a variable called obtained and we assign it a value of 475.
2. We have a variable called total and we assign it a value of 500.
3. We have a variable called percent and we assign it a value of obtained*100/total.
4. We print the value of percent.

Similar Posts