Skip to content

Instantly share code, notes, and snippets.

@guilhermesilveira
Last active August 29, 2015 14:08
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 guilhermesilveira/061f46a82f5af9a09a59 to your computer and use it in GitHub Desktop.
Save guilhermesilveira/061f46a82f5af9a09a59 to your computer and use it in GitHub Desktop.
function soma(a,b) {
return a + b;
}
function maior(a,b) {
if(a > b) return a;
return b;
}
function somaPositivos(a) {
var total = 0;
for(var i = 0; i < a.length; i++) {
if(a[i] < 0) return -1;
total += a[i];
}
return total;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment