In your Code, for removing the first word, you just need to ignore the first character by using substring(1)
off your rest of the output
var output = 'HelloWorld'.replace(/([A-Z])/g, (str) => { return '-' + str.toLowerCase() }).substring(1);
or alternatively you can convert from pascalcase to camelcase by doing this
var output = 'HelloWorld'.split(/(?=[A-Z])/g).map(function(value){ return value.charAt(0).toLowerCase()+ value.substring(1)}).join("-");
DEMO Below
var output = 'HelloWorld'.split(/(?=[A-Z])/g).map(function(value){ return value.charAt(0).toLowerCase()+ value.substring(1)}).join("-");
document.body.innerHTML += output;