Skip to content

Instantly share code, notes, and snippets.

@kyokutyo
Created October 7, 2013 15:48
Show Gist options
  • Save kyokutyo/6870141 to your computer and use it in GitHub Desktop.
Save kyokutyo/6870141 to your computer and use it in GitHub Desktop.
var sigma = function sigma(first, last, func) {
"use strict";
var ary = [],
i = first;
while(i <= last) {
ary.push(i++);
}
return ary.reduce(function(tmp, val) {
return tmp + func(val);
}, 0);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment