Попробуйте использовать, function test(val) { var x = Math.floor(val); return (val - x) > 0.5 ? Math.ceil(val) : (x + 0.5); } DEMO.
確定! 回上一頁