Skip to content

Instantly share code, notes, and snippets.

@genert
Created November 23, 2015 19:19
Show Gist options
  • Save genert/efff854bd4614030b557 to your computer and use it in GitHub Desktop.
Save genert/efff854bd4614030b557 to your computer and use it in GitHub Desktop.
function findSum () {
var sum = 0;
arguments.__proto__ = Array.prototype;
for (val of arguments) {
if (val < 0) return -1;
sum += val;
}
return sum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment