What's the best way to strip the "0."XXX% off a number and make it a percentage? What happens if the number happens to be an int?
var number1 = 4.954848;
var number2 = 5.9797;
$(document).ready(function() {
final = number1/number2;
alert(final.toFixed(2) + "%");
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…