Skip to content

Instantly share code, notes, and snippets.

@Prinzhorn
Created April 2, 2012 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Prinzhorn/2284835 to your computer and use it in GitHub Desktop.
Save Prinzhorn/2284835 to your computer and use it in GitHub Desktop.
Revising JavaScript's switch case
//This is part of a easing function I wrote
function(p, a) {
switch(true) {
case (p <= .5083):
a = 3; break;
case (p <= .8489):
a = 9; break;
case (p <= .96208):
a = 27; break;
case (p <= .99981):
a = 91; break;
default:
return 1;
}
return f(p, a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment