Computer scienceBackendNode.jsCore ConceptsInternal modulesHTTP server

Intro to URL module

Construct a URL

Report a typo

You need to construct a url string with username and password in the hostname. The username should be "newUser" and the password should be "MyPass@@". Complete the code given below.

The url module is already imported using the require method and is stored in a const url variable. Do not print the output, testing is handled internally.

Sample Input 1:

Sample Output 1:

https://newUser:MyPass%40%[email protected]
Write a program in JavaScript
const urlObject = {
protocol: "https:",
...
hostname: "www.example.com",
path: "/path/to/document",
};

const urlString = ...
___

Create a free account to access the full topic