Skip to content

Instantly share code, notes, and snippets.

@SerhiiLihus
Created November 24, 2015 06:43
Show Gist options
  • Save SerhiiLihus/307877bc7a85476dce68 to your computer and use it in GitHub Desktop.
Save SerhiiLihus/307877bc7a85476dce68 to your computer and use it in GitHub Desktop.
Reverse a String
// Bonfire: Reverse a String
// Author: @serhiilihus
// Challenge: http://www.freecodecamp.com/challenges/bonfire-reverse-a-string?solution=function%20reverseString(str)%20%7B%0A%20%20return%20str.split(%22%22).reverse().join(%22%22).toString()%3B%0A%7D%0A%0AreverseString(%22hello%22)%3B%0AreverseString(%22Howdy%22)%3B%0AreverseString(%22Greetings%20from%20Earth%22)%3B
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function reverseString(str) {
return str.split("").reverse().join("").toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment