Skip to content

Commit

Permalink
doc: fix myUrl is not defined in url
Browse files Browse the repository at this point in the history
Fixes a typo in the variable name in the URL code example in doc.
Renames `myUrl` to `myURL` for consistency and readability.

PR-URL: #46968
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Harshitha K P <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Akhil Marsonya <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Deokjin Kim <[email protected]>
  • Loading branch information
recrack authored and danielleadams committed Apr 11, 2023
1 parent 80b4e6d commit b37d53a
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit b37d53a

Please sign in to comment.