Task: Extract Protocol, Domain, and Port from URLs
Task: Extract Protocol, Domain, and Port from URLs: a task in Terminal-Lego-15k (Harbor dataset). Write a JavaScript program that extracts the full protocol, domain, and port (the origin) from a given URL string. The program should handle various URL formats and output only the protocol, hostname…
The task
Write a JavaScript program that extracts the full protocol, domain, and port (the origin) from a given URL string. The program should handle various URL formats and output only the protocol, hostname, and port (if present).
Part of PrimeIntellect/Terminal-Lego-15k.