Skip to content

Instantly share code, notes, and snippets.

@kevmor11
Created April 4, 2017 02:11
Show Gist options
  • Save kevmor11/4b5d36c141dc4cd36fc9aac840abcc20 to your computer and use it in GitHub Desktop.
Save kevmor11/4b5d36c141dc4cd36fc9aac840abcc20 to your computer and use it in GitHub Desktop.
reverses strings passed as arguments
function reverse (string) {
var result = "";
for (var i = string.length-1; i >= 0; i--) {
result += string[i];
}
return result;
};
for (var i = 2; i < process.argv.length; i++) {
var string = process.argv[i];
console.log(reverse(string));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment