Update article.md

Corrected grammatical errors.
This commit is contained in:
Beginnerds 2020-01-28 16:35:09 +05:30 committed by GitHub
parent ff042a0319
commit 4973824930
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,9 +3,9 @@
The built-in [URL](https://url.spec.whatwg.org/#api) class provides a convenient interface for creating and parsing URLs. The built-in [URL](https://url.spec.whatwg.org/#api) class provides a convenient interface for creating and parsing URLs.
There are no networking methods that require exactly an `URL` object, strings are good enough. So technically we don't have to use `URL`. But sometimes it can be really helpful. There are no networking methods that require exactly a `URL` object, strings are good enough. So technically we don't have to use `URL`. But sometimes it can be really helpful.
## Creating an URL ## Creating a URL
The syntax to create a new `URL` object: The syntax to create a new `URL` object:
@ -63,14 +63,14 @@ Here's the cheatsheet for URL components:
```smart header="We can pass `URL` objects to networking (and most other) methods instead of a string" ```smart header="We can pass `URL` objects to networking (and most other) methods instead of a string"
We can use an `URL` object in `fetch` or `XMLHttpRequest`, almost everywhere where an URL-string is expected. We can use a `URL` object in `fetch` or `XMLHttpRequest`, almost everywhere where a URL-string is expected.
Generally, `URL` object can be passed to any method instead of a string, as most method will perform the string conversion, that turns an `URL` object into a string with full URL. Generally, `URL` object can be passed to any method instead of a string, as most method will perform the string conversion, that turns a `URL` object into a string with full URL.
``` ```
## SearchParams "?..." ## SearchParams "?..."
Let's say we want to create an url with given search params, for instance, `https://google.com/search?query=JavaScript`. Let's say we want to create a url with given search params, for instance, `https://google.com/search?query=JavaScript`.
We can provide them in the URL string: We can provide them in the URL string: