Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function intToFloat(num, decimal) { [code goes here] }
- intToFloat(12, 1) // returns 12.0
- intToFloat(12, 2) // returns 12.00
- // and so onβ¦
- function intToFloat(num, decPlaces) { return num.toFixed(decPlaces); }
- function intToFloat(num, decPlaces) { return num + '.' + Array(decPlaces + 1).join('0'); }
- xAsString = (Number.isInteger(x)) ? (x + ".0") : (x.toString());
Add Comment
Please, Sign In to add comment