Decimals place showing in current temperature.

  • 1
  • Problem
  • Updated 4 years ago
Why is "temp_f" suddenly showing the decimals place also in my JSON? How do I get it to go back to rounding to the nearest full degree?
Photo of Toddd

Toddd

  • 2 Posts
  • 0 Reply Likes
  • frustrated.

Posted 6 years ago

  • 1
Photo of jbarko

jbarko

  • 2 Posts
  • 0 Reply Likes
i guess it's good to have too much than too little, but i was annoyed too until a simple fix:

var tmp = data.temp_f.toFixed(0);
......
.append(
$(document.createElement("temp"))
.text(tmp + "ÂoF")
)

btw, createElement("temp") is just a css class that I use for formatting, but its the next line that matters.