Skip to content

Instantly share code, notes, and snippets.

@potatowave
Forked from kvirani/average.js
Last active October 6, 2016 03:38
Show Gist options
  • Save potatowave/cc2f618ecea2d0878cd1c7e97ce93532 to your computer and use it in GitHub Desktop.
Save potatowave/cc2f618ecea2d0878cd1c7e97ce93532 to your computer and use it in GitHub Desktop.
Debugging Errors
function average(list) {
var sum = 0;
for (var num of list) {
sum += num;
}
return sum / list.length;
}
console.log(average([3, 5, 7]));
var input = process.argv[2];
if (input) {
console.log(reverse(input));
}
function reverse(original) {
return original.split('').reverse().join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment