These are chat archives for camperbot/bonfire-spinal-tap-case

14th
Jan 2016
Justin Richardsson
@hallaathrad
Jan 14 2016 18:03
hint
CamperBot
@camperbot
Jan 14 2016 18:03

hint [1/13]

## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Justin Richardsson
@hallaathrad
Jan 14 2016 18:03
hint
CamperBot
@camperbot
Jan 14 2016 18:03

hint [2/13]

# Problem Explanation:

  • Convert the given string to an all lowercase sentence joined by dashes.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Justin Richardsson
@hallaathrad
Jan 14 2016 18:03
hint
CamperBot
@camperbot
Jan 14 2016 18:03

hint [3/13]

Hint: 1

  • Create a regex to for all white spaces and underscores.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Justin Richardsson
@hallaathrad
Jan 14 2016 18:03
done
hint
CamperBot
@camperbot
Jan 14 2016 18:03

hint [4/13]

Hint: 2

  • You will also have to make everything lowercase.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Justin Richardsson
@hallaathrad
Jan 14 2016 18:03
moar!
hint
CamperBot
@camperbot
Jan 14 2016 18:03

hint [5/13]

Hint: 3

  • The tricky part is getting the regex part to work, once you do that then just turn the uppercase to lowercase and replace spaces with underscores using replace()

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Justin Richardsson
@hallaathrad
Jan 14 2016 18:11
moooore!
hine
hint
CamperBot
@camperbot
Jan 14 2016 18:11

hint [6/13]

Spoiler Alert!

687474703a2f2f7777772e796f75726472756d2e636f6d2f796f75726472756d2f696d616765732f323030372f31302f31302f7265645f7761726e696e675f7369676e5f322e676966.gif

Solution ahead!

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Justin Richardsson
@hallaathrad
Jan 14 2016 18:11
yeh yeh, gimme!
hint
CamperBot
@camperbot
Jan 14 2016 18:11

hint [7/13]

Code Solution:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Justin Richardsson
@hallaathrad
Jan 14 2016 18:11
YASSS
HINT
CamperBot
@camperbot
Jan 14 2016 18:11

hint [8/13]

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Justin Richardsson
@hallaathrad
Jan 14 2016 18:11
REALLY?
HINT!
CamperBot
@camperbot
Jan 14 2016 18:11

hint [9/13]

First solution

function spinalCase(str) {
  // Create a variable for the white space and underscores.
  var regex = /\s+|_+/g;

  // Replace low-upper case to low-space-uppercase
  str = str.replace(/([a-z])([A-Z])/g, '$1 $2');

  // Replace space and underscore with -
  return str.replace(regex, '-').toLowerCase();
}

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Justin Richardsson
@hallaathrad
Jan 14 2016 18:19
thanks camperbot