Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@outoftime
Created February 16, 2017 19: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 outoftime/a6a69939f2288a6ecbefb60e84152a31 to your computer and use it in GitHub Desktop.
Save outoftime/a6a69939f2288a6ecbefb60e84152a31 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=a6a69939f2288a6ecbefb60e84152a31
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
{"enabledLibraries":["jquery"]}
var tiers = [10, 15, 20, 25, 30, 35, 40];
var extraGrowth = 1;
var numerator = 0;
var denominator = 0;
for (var i = 0; i < tiers.length; i++) {
var multiplier = i === extraGrowth ? 1.2 : 1.1;
numerator += tiers[i] * multiplier;
denominator += multiplier;
}
$(document.body).append('The weighted average growth rate is ' + numerator / denominator);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment