HF RL Explorer

Task: Extract Base URL from a String in JavaScript

Task: Extract Base URL from a String in JavaScript: a task in Terminal-Lego-15k (Harbor dataset). Create a JavaScript (Node.js) solution that extracts the base URL (protocol + hostname) from a given full URL string. The solution should work with arbitrary URL strings — not by reading…

The task

Create a JavaScript (Node.js) solution that extracts the base URL (protocol + hostname) from a given full URL string. The solution should work with arbitrary URL strings — not by reading `window.location` or `document.URL`, but by parsing a string variable.

Part of PrimeIntellect/Terminal-Lego-15k.