Skip to content

Instantly share code, notes, and snippets.

@minitech
Created June 21, 2012 21:17
Show Gist options
  • Save minitech/2968589 to your computer and use it in GitHub Desktop.
Save minitech/2968589 to your computer and use it in GitHub Desktop.
JavaScript Temperature
// 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