Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Fix the typo in example output in url.md for url.hostname #33735

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion doc/api/url.md
Expand Up @@ -208,9 +208,15 @@ const myURL = new URL('https://example.org:81/foo');
console.log(myURL.hostname);
// Prints example.org

// Setting the hostname does not change the port
myURL.hostname = 'example.com:82';
console.log(myURL.href);
darkrishabh marked this conversation as resolved.
Show resolved Hide resolved
// Prints https://example.com:81/foo
// Prints https://example.com:82/foo
darkrishabh marked this conversation as resolved.
Show resolved Hide resolved
darkrishabh marked this conversation as resolved.
Show resolved Hide resolved

// Use, myURL.host to change the hostname and port
myURL.host = 'example.org:82';
console.log(myURL.href);
// Prints https://example.org:82/foo
```

Invalid host name values assigned to the `hostname` property are ignored.
Expand Down