With the help of urlObject.pathname() method, we can find the name of the path which is used by the given hostname. This contains all the things starting from the host (with the port) and before the beginning of the query or hash components, which are delimited by one of the ASCII question mark (?) or hash (#) characters.
Syntax: urlObject.pathname() Return: Returns the pathname used(i.e.'/p/a/t/h')
- Google Chrome
- Apple Safari
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.