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