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 myUrl is not defined in url #46968

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Changes from all 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
10 changes: 5 additions & 5 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,14 +554,14 @@ instance, the `URL` object will not percent encode the ASCII tilde (`~`)
character, while `URLSearchParams` will always encode it:

```js
const myUrl = new URL('https://example.org/abc?foo=~bar');
const myURL = new URL('https://example.org/abc?foo=~bar');

console.log(myUrl.search); // prints ?foo=~bar
console.log(myURL.search); // prints ?foo=~bar

// Modify the URL via searchParams...
myUrl.searchParams.sort();
myURL.searchParams.sort();

console.log(myUrl.search); // prints ?foo=%7Ebar
console.log(myURL.search); // prints ?foo=%7Ebar
```

#### `url.username`
Expand Down Expand Up @@ -1271,7 +1271,7 @@ console.log(urlToHttpOptions(myURL));
const { urlToHttpOptions } = require('node:url');
const myURL = new URL('https://a:b@測試?abc#foo');

console.log(urlToHttpOptions(myUrl));
console.log(urlToHttpOptions(myURL));
/*
{
protocol: 'https:',
Expand Down