-
-
Save patrickcurl/b8191ba2d5e49943ca81 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/patrickcurl 's solution for Bonfire: Spinal Tap Case
This file contains 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