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
Post a Comment