Skip to content

Instantly share code, notes, and snippets.

  • Save anonymous/ec130867f4ac95ac938f to your computer and use it in GitHub Desktop.
Save anonymous/ec130867f4ac95ac938f to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/goodbedford 's solution for Bonfire: Reverse a String
// Bonfire: Reverse a String
// Author: @goodbedford
// Challenge: http://www.freecodecamp.com/challenges/bonfire-reverse-a-string?solution=function%20reverseString(str)%20%7B%0A%20%20%20%0A%20str%20%3D%20str.split(%22%22).reverse().join(%22%22)%3B%0A%20%20%0A%20%20return%20str%3B%0A%7D%0A%0AreverseString(%22hello%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function reverseString(str) {
str = str.split("").reverse().join("");
return str;
}
reverseString("hello");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment