round number with JS
function roundedNum(somenum) { return (0.5 + somenum) | 0; } function roundedNum(somenum) { return ~~(0.5 + somenum); } function roundedNum(somenum) { return (0.5 + somenum) << 0; }