Skip to content

Instantly share code, notes, and snippets.

View KyleFlemington's full-sized avatar

Kyle Flemington KyleFlemington

View GitHub Profile
@KyleFlemington
KyleFlemington / Reversing a String (Stretch)
Created October 23, 2016 03:10
Reversing a string without using Array.prototype.reverse or Array.prototype.join functions to solve this problem.
var toBeReversed = process.argv[2];
function reverse(toBeReversed) {
var revOutput = "";
for (var i = toBeReversed.length -1; i >= 0; i--) {
revOutput += toBeReversed[i];
}
return revOutput;
}
console.log(reverse(toBeReversed));
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>