how to get url slug in javascript code example Example: javascript get url path window.location.pathname