There are several different methods for converting floating point numbers to Integers in JavaScript. My question is what method gives the best performance, is most compatibl
That's rounding to 0 places, slightly different than truncating, and as someone else suggested, toFixed returns a string, not a raw integer. Useful for display purposes.
var num = 2.7; // typeof num is "Number"
num.toFixed(0) == "3"