I want to convert these strings:
fooBar FooBar
into:
foo-bar -foo-bar
How would I do this in JavaScript the m
For those who do not need the preceding hyphen:
console.log ("CamelCase".replace(/[A-Z]/g, (match, offset) => (offset > 0 ? '-' : '') + match.toLowerCase()))