cara mengonversi case string ke kebab di javascript

const kebabCase = (string) => {
  const kebabCase = string => string
      .replace(/([a-z])([A-Z])/g, "$1-$2")
      .replace(/[\s_]+/g, '-')
      .toLowerCase();

  const newText = kebabCase(string);
  return newText
};
mrmalik610