Skip to content

Instantly share code, notes, and snippets.

@maxjustus
Created September 16, 2011 20:02
Show Gist options
  • Save maxjustus/1222988 to your computer and use it in GitHub Desktop.
Save maxjustus/1222988 to your computer and use it in GitHub Desktop.
function percentChanged(newVal, oldVal) {
if(oldVal == 0) {
return (newVal * 100);
} else {
return parseInt((((newVal - oldVal) / oldVal) * 100).toFixed());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment