Skip to content

Instantly share code, notes, and snippets.

@joePichardo
Last active December 9, 2015 16:42
Show Gist options
  • Save joePichardo/c3a050a795f3fb3605b1 to your computer and use it in GitHub Desktop.
Save joePichardo/c3a050a795f3fb3605b1 to your computer and use it in GitHub Desktop.
Reverse a String
// Bonfire: Reverse a String
// Author: @joepichardo
// Challenge: http://www.freecodecamp.com/challenges/bonfire-reverse-a-string
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function reverseString(str) {
var myArray = str.split(""); //splits each letter
myArray.reverse();
str = myArray.join("");//joins each letter w/o commas in b/w
return str;
}
reverseString("hello");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment