Skip to content

Commit b2f9c07

Browse files
authored
Merge pull request #4 from longo-andrea/master
Correct some typos.
2 parents 4f2a80d + c29dedf commit b2f9c07

8 files changed

Lines changed: 33 additions & 32 deletions

File tree

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
# Conversione di tipi
22

3-
Nella maggior parte dei casi, operatori e funzioni convertono automaticamente il valore nel tipo corretto. Questo viene detto "conversione di tipi".
3+
Nella maggior parte dei casi, operatori e funzioni convertono automaticamente il valore nel tipo corretto.
44

55
Ad esempio, `alert` converte automaticamente un valore qualsiasi in una stringa, per poterla mostrare. Le operazioni matematica convertono i valori in numeri.
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
@@ -380,7 +380,7 @@ Questi esempi assumono i significati comuni dei prefissi. Il loro significato di
380380
```smart header="Nomi di funzioni ultra-corti"
381381
Funzioni che vengono utilizzate *molto spesso* potrebbero avere nomi molto corti.
382382
383-
Ad esempio il framework [jQuery](http://jquery.com) definisce una funzione con `$`. La libreria [LoDash](http://lodash.com/) ha nel core una funzione denominata `_`.
383+
Ad esempio il framework [jQuery](http://jquery.com) definisce una funzione con `$`. La libreria [Lodash](http://lodash.com/) ha nel core una funzione denominata `_`.
384384
385385
Queste sono eccezioni. Generalmente i nomi delle funzioni sono precisi e descrittivi.
386386
```

1-js/06-advanced-functions/05-global-object/article.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,41 @@ alert("Hello");
1414
window.alert("Hello");
1515
```
1616

17-
LO stesso vale per tutte le altre funzioni integrate, ad esempio possiamo invocare `Array` come `window.Array` e creare le nostre personali proprietà.
17+
Lo stesso vale per tutte le altre funzioni integrate, ad esempio possiamo invocare `Array` come `window.Array` e creare le nostre personali proprietà.
1818

1919
## Browser: l'oggetto "window"
2020

21-
Per ragioni storiche, l'oggetto `window` è leggermente incasinato.
21+
Per ragioni storiche, l'oggetto `window` è leggermente incasinato.
2222

23-
1. Fornisce la funzionalità di "finestra del browser", oltre a svolgere il ruolo di oggetto globale.
23+
1. Fornisce la funzionalità di "finestra del browser", oltre a svolgere il ruolo di oggetto globale.
2424

25-
Possiamo utilizzare `window` per accedere a proprietà e metodi, specifici di una finestra del browser:
25+
Possiamo utilizzare `window` per accedere a proprietà e metodi, specifici di una finestra del browser:
2626

2727
```js run
2828
alert(window.innerHeight); // mostra l'altezza della window
2929

3030
window.open('http://google.com'); // apre una nuova browser window
3131
```
3232

33-
2. Le variabili `var` e le dichiarazioni di funzioni diventano automaticamente delle proprietà di `window`.
33+
2. Le variabili `var` e le dichiarazioni di funzioni diventano automaticamente delle proprietà di `window`.
3434

3535
Ad esempio:
3636
```js untrusted run no-strict refresh
3737
var x = 5;
3838
39-
alert(window.x); // 5 (var x diventa una proprietà di window)
39+
alert(window.x); // 5 (var x diventa una proprietà di window)
4040
4141
window.x = 0;
4242
4343
alert(x); // 0, variabile modificata
4444
```
4545

46-
Da notare che tutto ciò non vale per le dichiarazioni `let/const`:
46+
Da notare che tutto ciò non vale per le dichiarazioni `let/const`:
4747

4848
```js untrusted run no-strict refresh
4949
let x = 5;
5050
51-
alert(window.x); // undefined ("let" non crea proprietà sull'oggetto window)
51+
alert(window.x); // undefined ("let" non crea proprietà sull'oggetto window)
5252
```
5353

5454
3. Inoltre, tutti gli script condividono lo stesso scope globale, quindi le variabili dichiarate all'interno di uno `<script>` diventano visibili anche negli altri:
@@ -65,25 +65,25 @@ Per ragioni storiche, l'oggetto `window`
6565
</script>
6666
```
6767
68-
4. Un ultima cosa, il valore di `this` nello scope globale è `window`.
68+
4. Un'ultima cosa, il valore di `this` nello scope globale è `window`.
6969

7070
```js untrusted run no-strict refresh
7171
alert(this); // window
7272
```
7373

74-
Perché è stato fatto cosi? Nel momento in cui è stato creato il linguaggio, l'idea era quella di fondere diversi aspetti in un unico oggetto `window` per "rendere le cose più semplici". Ma da quel momento sono cambiate molte cose. Da piccoli script si è passati a grandi applicazioni le quali richiedono una propria architettura.
74+
Perché è stato fatto cosi? Nel momento in cui è stato creato il linguaggio, l'idea era quella di fondere diversi aspetti in un unico oggetto `window` per "rendere le cose più semplici". Ma da quel momento sono cambiate molte cose. Da piccoli script si è passati a grandi applicazioni le quali richiedono una propria architettura.
7575
7676
E' una cosa buona che diversi script (eventualmente anche provenienti da altri sviluppatori) si vedano le variabili a vicenda?
7777

7878
Ovviamente no, questa caratteristica potrebbe portare ad errori dovuti a conflitti tra nomi: due variabili (di script diversi) con uno stesso nome potrebbero aver scopi differenti nei diversi script in cui vengono utilizzate.
7979

8080
Ad oggi, questa caratteristica di `window` viene considerata un errore nel design del linguaggio.
8181

82-
Fortunatamente esiste una soluzione per "aggirare" questo problema, ed è chiamata "JavaScript module".
82+
Fortunatamente esiste una soluzione per "aggirare" questo problema, ed è chiamata "JavaScript module".
8383

84-
Se impostiamo `type="module"` come attributo su un tag `<script>`, allora questo script verrà considerato un "modulo" separato con il suo suo personale scope globale (lexical environment), e non interferirà con `window`.
84+
Se impostiamo `type="module"` come attributo su un tag `<script>`, allora questo script verrà considerato un "modulo" separato con il suo suo personale scope globale (lexical environment), e non interferirà con `window`.
8585

86-
- In un modulo, `var x` non diventerà una proprietà di `window`:
86+
- In un modulo, `var x` non diventerà una proprietà di `window`:
8787

8888
```html run
8989
<script type="module">
@@ -106,7 +106,7 @@ Se impostiamo `type="module"` come attributo su un tag `<script>`, allora questo
106106
</script>
107107
```
108108

109-
- E come ultima cosa, il valore di `this` (al livello globale) in un modulo sarà `undefined` (non avrebbe alcun senso se contenesse `window`?):
109+
- E come ultima cosa, il valore di `this` (al livello globale) in un modulo sarà `undefined` (non avrebbe alcun senso se contenesse `window`?):
110110

111111
```html run
112112
<script type="module">
@@ -116,11 +116,11 @@ Se impostiamo `type="module"` come attributo su un tag `<script>`, allora questo
116116

117117
**L'utilizzo di `<script type="module">` risolve i difetti di design del linguaggio, separando il livello massimo (top-level) da `window`.**
118118
119-
Più avanti tratteremo più in dettaglio questo argomento, nel capitolo [](info:modules).
119+
Più avanti tratteremo più in dettaglio questo argomento, nel capitolo [](info:modules).
120120
121121
## Utilizzi sensati dell'oggetto globale
122122

123-
1. L'utilizzo delle variabili globali, solitamente è sconsigliato. Dovrebbero esserci il minor numero di variabili globali possibili, ma se proprio ne avessimo bisogno possiamo comunque sfruttare l'oggetto globale `window` (o `global` in Node.js).
123+
1. L'utilizzo delle variabili globali, solitamente è sconsigliato. Dovrebbero esserci il minor numero di variabili globali possibili, ma se proprio ne avessimo bisogno possiamo comunque sfruttare l'oggetto globale `window` (o `global` in Node.js).
124124

125125
Qui inseriamo delle informazioni riguardo l'utente nell'oggetto globale, in modo tale da renderle accessibili anche agli altri script:
126126

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.

1-js/13-modules/02-import-export/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ export {default as Github} from './providers/github.js';
377377
````warn header="Re-exporting default is tricky"
378378
Please note: `export User from './user.js'` won't work. It's actually a syntax error. To re-export the default export, we must mention it explicitly `{default as ...}`, like in the example above.
379379
380-
Also, there's another oddity: `export * from './user.js'` re-exports only named exports, exluding the default one. Once again, we need to mention it explicitly.
380+
Also, there's another oddity: `export * from './user.js'` re-exports only named exports, excluding the default one. Once again, we need to mention it explicitly.
381381
382382
For instance, to re-export everything, two statements will be necessary:
383383
```js

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)