diff --git a/5-network/01-fetch/article.md b/5-network/01-fetch/article.md index 8ff29cc8..1170042e 100644 --- a/5-network/01-fetch/article.md +++ b/5-network/01-fetch/article.md @@ -12,11 +12,11 @@ For example, we can use a network request to: ...And all of that without reloading the page! -There's an umbrella term "AJAX" (abbreviated Asynchronous JavaScript And XML) for network requests from JavaScript. We don't have to use XML though: the term comes from old times, that's that word is there. You may have heard that term already. +There's an umbrella term "AJAX" (abbreviated Asynchronous JavaScript And XML) for network requests from JavaScript. We don't have to use XML though: the term comes from old times, that's why that word is there. You may have heard that term already. There are multiple ways to send a network request and get information from the server. -The `fetch()` method is modern and versatile, so we'll start with it. It's not supported by old browsers (can be polyfilled), but very well supported among the new ones. +The `fetch()` method is modern and versatile, so we'll start with it. It's not supported by old browsers (can be polyfilled), but very well supported among the modern ones. The basic syntax is: @@ -27,11 +27,13 @@ let promise = fetch(url, [options]) - **`url`** -- the URL to access. - **`options`** -- optional parameters: method, headers etc. +Without `options`, that is a simple GET request, downloading the contents of the `url`. + The browser starts the request right away and returns a promise that the calling code should use to get the result. Getting a response is usually a two-stage process. -**First, the `promise` resolves with an object of the built-in [Response](https://fetch.spec.whatwg.org/#response-class) class as soon as the server responds with headers.** +**First, the `promise`, returned by `fetch`, resolves with an object of the built-in [Response](https://fetch.spec.whatwg.org/#response-class) class as soon as the server responds with headers.** At this stage we can check HTTP status, to see whether it is successful or not, check headers, but don't have the body yet. diff --git a/9-regular-expressions/09-regexp-groups/article.md b/9-regular-expressions/09-regexp-groups/article.md index 141d0300..0d858e44 100644 --- a/9-regular-expressions/09-regexp-groups/article.md +++ b/9-regular-expressions/09-regexp-groups/article.md @@ -35,7 +35,7 @@ The pattern: `pattern:[-.\w]+@([\w-]+\.)+[\w-]{2,20}`. That regexp is not perfect, but good enough to fix errors or occasional mistypes. -For instance, we can find all emails in the string: +For instance, we can find all emails in the string: ```js run let reg = /[-.\w]+@([\w-]+\.)+[\w-]{2,20}/g; @@ -43,7 +43,7 @@ let reg = /[-.\w]+@([\w-]+\.)+[\w-]{2,20}/g; alert("my@mail.com @ his@site.com.uk".match(reg)); // my@mail.com, his@site.com.uk ``` -In this example parentheses were used to make a group for repeating `pattern:(...)+`. But there are other uses too, let's see them. +In this example parentheses were used to make a group for repetitions `pattern:([\w-]+\.)+`. But there are other uses too, let's see them. ## Contents of parentheses @@ -53,7 +53,7 @@ For instance, we'd like to find HTML tags `pattern:<.*?>`, and process them. Let's wrap the inner content into parentheses, like this: `pattern:<(.*?)>`. -We'll get both the tag as a whole and its content as an array: +Then we'll get both the tag as a whole and its content: ```js run let str = '