get path of url in javascript from string code example Example: javascript get url path window.location.pathname