To convert a string from Camel Case to Dashed format, use the following function:
function unCamelCase(str) {
return str.replace(/([a-z])([A-Z])/, "$1-$2").toLowerCase();
}
To use the function, see the following code:
unCamelCase("fooBar"); // will return "foo-bar"