javascript get part of current url code example Example: javascript get url path window.location.pathname