Tell us what’s happening:
Hi, guys. I’m trying to find all the capitals letters that are not at the beginning of the string, and are joined to the previous word without whitespace. I plan to insert whitespaces in front of them for later transform. Here I tried to use noncapture groups to select all capital letters that have lowercase letters before them, but the console returned null. Earlier I tried to use lookbehind from ES2018 in the same way, and the result remains null. Can someone tell me if I’m logically wrong or if there are syntax errors? Thanks
Your code so far
function spinalCase(str) {
// "It's such a fine line between stupid, and clever."
// --David St. Hubbins
let findCapitals = str.match(/(?:[a-z])([A-Z])/);
console.log(findCapitals)
return str;
}
spinalCase('This Is Spinal Tap');
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/spinal-tap-case