Skip to content

Instantly share code, notes, and snippets.

@rickbacci
Created October 13, 2015 15:26
Show Gist options
  • Save rickbacci/02dd64a8a892e2e78fda to your computer and use it in GitHub Desktop.
Save rickbacci/02dd64a8a892e2e78fda to your computer and use it in GitHub Desktop.
function echo(args) {
if(Array.isArray(args)) {
args.forEach(function(element) {
console.log(element);
});
} else {
for (i = 0; i < arguments.length; i++) {
console.log(arguments[i]);
}
}
}
// echo();
echo(['one', 'two', 'three']);
echo('one', 'two', 'three');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment