Skip to content

Commit 4d3a2c0

Browse files
committed
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-19223ae7
2 parents 0056b87 + 19223ae commit 4d3a2c0

File tree

7 files changed

+17
-16
lines changed

7 files changed

+17
-16
lines changed

1-js/02-first-steps/04-variables/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ let userName;
157157
let test123;
158158
```
159159
160-
When the name contains multiple words, [camelCase](https://en.wikipedia.org/wiki/CamelCase) is commonly used. That is: words go one after another, each word starting with a capital letter: `myVeryLongName`.
160+
When the name contains multiple words, [camelCase](https://en.wikipedia.org/wiki/CamelCase) is commonly used. That is: words go one after another, each word except first starting with a capital letter: `myVeryLongName`.
161161
162162
What's interesting -- the dollar sign `'$'` and the underscore `'_'` can also be used in names. They are regular symbols, just like letters, without any special meaning.
163163

1-js/02-first-steps/06-type-conversions/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Type Conversions
22

3-
Most of the time, operators and functions automatically convert the values given to them to the right type. This is called "type conversion".
3+
Most of the time, operators and functions automatically convert the values given to them to the right type.
44

55
For example, `alert` automatically converts any value to a string to show it. Mathematical operations convert values to numbers.
66

1-js/02-first-steps/14-function-basics/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ These examples assume common meanings of prefixes. What they mean for you is det
382382
```smart header="Ultrashort function names"
383383
Functions that are used *very often* sometimes have ultrashort names.
384384

385-
For example, the [jQuery](http://jquery.com) framework defines a function with `$`. The [LoDash](http://lodash.com/) library has its core function named `_`.
385+
For example, the [jQuery](http://jquery.com) framework defines a function with `$`. The [Lodash](http://lodash.com/) library has its core function named `_`.
386386

387387
These are exceptions. Generally functions names should be concise and descriptive.
388388
```

1-js/08-prototypes/02-function-prototype/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ On the picture, `"prototype"` is a horizontal arrow, meaning a regular property,
4343
```smart header="`F.prototype` only used at `new F` time"
4444
`F.prototype` property is only used when `new F` is called, it assigns `[[Prototype]]` of the new object. After that, there's no connection between `F.prototype` and the new object. Think of it as a "one-time gift".
4545

46-
If, after the creation, `F.prototype` property changes (`F.property = <another object>`), then new objects created by `new F` will have another object as `[[Prototype]]`, but already existing objects keep the old one.
46+
If, after the creation, `F.prototype` property changes (`F.prototype = <another object>`), then new objects created by `new F` will have another object as `[[Prototype]]`, but already existing objects keep the old one.
4747
```
4848
4949
## Default F.prototype, constructor property

1-js/09-classes/01-class/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ alert(typeof User); // function
8686

8787
What `class User {...}` construct really does is:
8888
1. Creates a function named `User`, that becomes the result of the class declaration.
89-
- The function code is taken from the `constructor` method (assumed empty is we don't write such method).
89+
- The function code is taken from the `constructor` method (assumed empty if we don't write such method).
9090
3. Stores all methods, such as `sayHi`, in `User.prototype`.
9191

9292
Afterwards, for new objects, when we call a method, it's taken from the prototype, just as described in the chapter <info:function-prototype>. So `new User` object has access to class methods.

8-web-components/1-webcomponents-intro/article.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ Components may have subcomponents, e.g. messages may be parts of a higher-level
5656

5757
How do we decide, what is a component? That comes from intuition, experience and common sense. Usually it's a separate visual entity that we can describe in terms of what it does and how it interacts with the page. In the case above, the page has blocks, each of them plays its own role, it's logical to make these components.
5858

59-
- A component has its own JavaScript class.
59+
A component has:
60+
- its own JavaScript class.
6061
- DOM structure, managed solely by its class, outside code doesn't access it ("encapsulation" principle).
6162
- CSS styles, applied to the component.
6263
- API: events, class methods etc, to interact with other components.

9-regular-expressions/02-regexp-methods/article.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ There are two sets of methods to deal with regular expressions.
1010

1111
Which method to use depends on what we'd like to do.
1212

13-
Methods become much easier to understand if we separate them by their use in real-life tasks:
13+
Methods become much easier to understand if we separate them by their use in real-life tasks.
14+
15+
So, here are general recipes, the details to follow:
1416

1517
**To search for all matches:**
1618

@@ -30,9 +32,7 @@ Use regexp `g` flag and:
3032
**To split the string by a separator:**
3133
- `str.split(str|reg)`
3234

33-
Now you get the details about every method in this chapter... But if you're reading for the first time, and want to know more about regexps - go ahead!
34-
35-
You may want to skip methods for now, move on to the next chapter, and then return here if something about a method is unclear.
35+
Now you can continue reading this chapter to get the details about every method... But if you're reading for the first time, then you probably want to know more about regexps. So you can move to the next chapter, and then return here if something about a method is unclear.
3636

3737
## str.search(reg)
3838

@@ -41,12 +41,12 @@ We've seen this method already. It returns the position of the first match or `-
4141
```js run
4242
let str = "A drop of ink may make a million think";
4343

44-
alert( str.search( *!*/a/i*/!* ) ); // 0 (the first position)
44+
alert( str.search( *!*/a/i*/!* ) ); // 0 (first match at zero position)
4545
```
4646
4747
**The important limitation: `search` only finds the first match.**
4848
49-
We can't find next positions using `search`, there's just no syntax for that. But there are other methods that can.
49+
We can't find next matches using `search`, there's just no syntax for that. But there are other methods that can.
5050
5151
## str.match(reg), no "g" flag
5252
@@ -215,9 +215,9 @@ alert('12-34-56'.split(/-/)) // array of [12, 34, 56]
215215
216216
## str.replace(str|reg, str|func)
217217
218-
That's actually a great method, one of most useful ones. The swiss army knife for searching and replacing.
218+
This is a generic method for searching and replacing, one of most useful ones. The swiss army knife for searching and replacing.
219219
220-
The simplest use -- searching and replacing a substring, like this:
220+
We can use it without regexps, to search and replace a substring:
221221
222222
```js run
223223
// replace a dash by a colon
@@ -263,7 +263,7 @@ Quite often we'd like to reuse parts of the source string, recombine them in the
263263
264264
To do so, we should:
265265
1. First, mark the parts by parentheses in regexp.
266-
2. Use `$1`, `$2` (and so on) in the replacement string to get the content matched by parentheses.
266+
2. Use `$1`, `$2` (and so on) in the replacement string to get the content matched by 1st, 2nd and so on parentheses.
267267
268268
For instance:
269269
@@ -433,7 +433,7 @@ alert( regexp.test(str) ); // false (no match)
433433
434434
435435
````warn header="Same global regexp tested repeatedly may fail to match"
436-
If we apply the same global regexp to different inputs, it may lead to wrong result, because `regexp.test` call advances `regexp.lastIndex` property, so next matches start from non-zero position.
436+
If we apply the same global regexp to different inputs, it may lead to wrong result, because `regexp.test` call advances `regexp.lastIndex` property, so the search in another string may start from non-zero position.
437437
438438
For instance, here we call `regexp.test` twice on the same text, and the second time fails:
439439

0 commit comments

Comments
 (0)