Skip to content

Instantly share code, notes, and snippets.

Created December 9, 2015 13:21
Show Gist options
  • Save anonymous/8a1a0f0799e71a7a70a6 to your computer and use it in GitHub Desktop.
Save anonymous/8a1a0f0799e71a7a70a6 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/patrickcurl 's solution for Bonfire: Spinal Tap Case
// 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