javascript - Jquery math less than 0 show 0 -


how stop below returning value less 0. want less 0 show 0. appreciated.

$("#spanrpower_co2").text (math.round(-data[0] * 16.8) * 100 / 100); 

data[0] > 0 ? 0 : -math.round(16.8 * data[0]); clearer.

note unless you're approaching floating point infinity, * 100 / 100 no-op.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -