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