Skip to content

Instantly share code, notes, and snippets.

@hora

hora/average.js Secret

Last active November 23, 2021 22:10
Show Gist options
  • Save hora/9296ddcb7e9bc398124f to your computer and use it in GitHub Desktop.
Save hora/9296ddcb7e9bc398124f 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 orignal.split('').reverseList().join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment