JSFiddle - React, Tailwind, and code Playground

HTML

<span id="out"></span>

JavaScript

// Input
var x = "The cow's dilemna: when is a \"burger\" more than _just_ a burger!?";
// Output
document.getElementById('out').innerHTML = x
    // remove non-word (\w) chars, non-whitespace (\s) characters, and underscores
    .replace(/[^\w\s]|_/g, '')
    // replace groups of 1 or more whitespace with hyphens
    .replace(/\s+/g, '-')
    // lower case
    .toLowerCase();