I think the best approach for this, logically, is to treat it like actual temperature. Assign each character a body temperature. For humans that's 98.6°F or 37°C. If you don't want to use degrees, you could just use percentages to make life easier so you could have 100% = optimal body temperature. It's all the same it just depends on if you like nice round numbers or numbers you can compare to real life.
Let's assume you chose Farenheit since that's what I'm most familiar with.
You could then have your map (or even terrain) have a temperature value. A snowy mountain might be 30°, quite cold! An arid desert might be 110°, scorching!
Then you would affect the characters by raising or lowering their temperatures by a small amount at certain intervals. You could use common events but since we do have access to JavaScript, you could also do it based on a time interval like every 60 seconds. What you would do is determine how many interval ticks it should take for the character's body temp to match the terrain. I think 10 is probably realistic. So every minute (or whatever interval you choose) you would take the difference in temperature between the terrain and the character's optimal body temperature, divide that by 10 and then add the resulting number to their body temperature. I call this a rate of homeostasis (rate in which the temperature balances out).
You would then have safety thresholds for the characters. Perhaps at 105°F they start suffering heat exhaustion and start losing HP. Perhaps at 85°F they suffer hyperthermia and become sluggish.
For the clothes: For this last part you would add a property to your armor/clothing that would affect the rate in which body temperature changes. The formula you would use should be similar to the general formula for how the terrain affects temperature but warming garments would have a positive effect on temperature (increase) and cooling garments would have a negative effect (decrease). If the terrain has a homeostasis rate of 10%, most clothing would probably have a less powerful effect. A fur coat, for example, could have +5% warmth which would be a +5% homeostasis rate to increase temperature.
Let's look at some formulas to use as examples:
Snowy Mountain:
Terrain Temperature: 30°F.
Body Temperature: 98°F.
Homeostasis Rate: 10%
Temperature Changes: Every 60 seconds
Change Rate: (30-98) / 10 = -6.8° every minute
Arid Desert
Terrain Temperature: 110°F.
Body Temperature: 98°F.
Homeostasis Rate: 10%
Temperature Changes: Every 60 seconds
Change Rate: (110-98) / 10 = +1.2° every minute
Fur Coat
Homeostasis Rate: 5%
Change Rate: |(Terrain - Body)| / 20 = ??? [Depends on Terrain, Always Positive]
Skimpy Bathing Suit
Homeostasis Rate: 5%
Change Rate: (|(Terrain - Body) / 20|) * -1 = ??? [Depends on Terrain, Always Negative]
Fur Coat in Snowy Mountain:
Change Rate: |(30-98)| / 20 = +3.4° every minute
Overall Rate: [(30-98)/10] + [|(30-98)|/20] = -3.4° Every Minute
Fur Coat in Arid Desert:
Change Rate: |(110-98)| / 20 = +0.6° every minute
Overall Rate: [(110-98)/10] + [|(110-98)|/20] = +1.8° Every Minute
Bathing Suit in Snowy Mountain:
Change Rate: |(30-98) / 20| * -1= -3.4° every minute
Overall Rate: [(30-98)/10] + [|(30-98) / 20| * -1] = -10.2° Every Minute
Bathing Suit in Arid Desert:
Change Rate: [|(110-98)| / 20] * -1 = -0.6° every minute
Overall Rate: [(110-98)/10] + [|(110-98)/20| * -1] = +0.6° Every Minute
The pipe characters |these ones| mean absolute value (so regardless if the resulting number is negative, just use it as positive). Notice how the bathing suit actually makes you lose heat faster in the cold and the fur coat makes you overheat faster in the heat.
I realize this is not code at all but I think this is the basis for a much easier-to-code component. A solid logical design will make for code that's easier to maintain.