Created
December 9, 2015 13:21
-
-
Save anonymous/8a1a0f0799e71a7a70a6 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/patrickcurl 's solution for Bonfire: Spinal Tap Case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bonfire: Spinal Tap Case | |
// Author: @patrickcurl | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-spinal-tap-case | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function spinalCase(str) { | |
return str.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/\s+|_+/g, '-').toLowerCase(); | |
} | |
spinalCase('This Is Spinal Tap'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment