Created
June 21, 2012 21:17
-
-
Save minitech/2968589 to your computer and use it in GitHub Desktop.
JavaScript Temperature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Andrew Stewart wants this: | |
// http://stwrt.ca/HVpT | |
// in JavaScript. Concisely. | |
function temperature_icon(temp) { | |
if(temp < -40 || temp > 30) return 'E'; | |
return ')_+QW'.charAt( | |
(temp > 0) | |
+ (temp > 10) | |
+ (temp > 15) | |
+ (temp > 20) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment