You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Try setting temp and avgTemp to 0 first:

        var temp=0;
        var avgTemp=0;
    

    In JavaScript, values default to undefined, and undefined + 0.0 == NaN.

About

Avatar for Gordon @Gordon started