The JavaScript function parseInt can be used to force conversion of a given parameter to an integer, whether that parameter is a string, float number, number, etc.
parseInt
There are different manifestations when negative numbers between 'Math.floor' and 'parseInt'.
you should use this: 1.2 | 0
or (1.2).toFixed(0)