You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/01-getting-started/1-intro/article.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,11 +24,19 @@ Il browser ha un suo motore JavaScript integrato, chiamato alle volte "JavaScrip
24
24
25
25
Esistono altri motori JavaScript, tra cui:
26
26
27
+
<<<<<<< HEAD
27
28
-[V8](https://en.wikipedia.org/wiki/V8_(JavaScript_engine)) -- per Chrome e Opera.
28
29
-[SpiderMonkey](https://en.wikipedia.org/wiki/SpiderMonkey) -- per Firefox.
29
30
- ...Ci sono altri codenames come "Chakra" per IE, "JavaScriptCore", "Nitro" e "SquirrelFish" per Safari, etc.
30
31
31
32
I nomi citati sopra possono essere utili da ricordare, poiché si possono trovare spesso in articoli che trattano di sviluppo web. Anche noi li useremo. Ad esempio, se "una caratteristica X è supportata da V8", probabilmente funzioneranno senza problemi in Chrome e Opera.
33
+
=======
34
+
-[V8](https://en.wikipedia.org/wiki/V8_(JavaScript_engine)) -- in Chrome, Opera and Edge.
35
+
-[SpiderMonkey](https://en.wikipedia.org/wiki/SpiderMonkey) -- in Firefox.
36
+
- ...There are other codenames like "Chakra" for IE, "JavaScriptCore", "Nitro" and "SquirrelFish" for Safari, etc.
37
+
38
+
The terms above are good to remember because they are used in developer articles on the internet. We'll use them too. For instance, if "a feature X is supported by V8", then it probably works in Chrome, Opera and Edge.
39
+
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
32
40
33
41
```smart header="Come funzionano questi motori?"
34
42
@@ -60,7 +68,11 @@ Ad esempio, è possibile:
60
68
61
69
## Cosa NON può fare JavaScript a livello browser?
62
70
71
+
<<<<<<< HEAD
63
72
Per la sicurezza dell'utente, le possibilità di JavaScript nel browser sono limitate. L'intento è di prevenire che una pagina "maligna" tenti di accedere alle informazioni personali o di danneggiare i dati degli utenti.
73
+
=======
74
+
JavaScript's abilities in the browser are limited for the sake of a user's safety. The aim is to prevent an evil webpage from accessing private information or harming the user's data.
75
+
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
64
76
65
77
Esempi di queste restrizioni possono essere:
66
78
@@ -85,9 +97,15 @@ Queste limitazioni non si pongono se JavaScript viene eseguito fuori dal browser
85
97
Ci sono almeno *tre* cose che rendono JavaScript cosi unico:
86
98
87
99
```compare
100
+
<<<<<<< HEAD
88
101
+ Completa integrazione con HTML/CSS.
89
102
+ Operazioni semplici vengono eseguite semplicemente.
90
103
+ Supportato dai maggiori browser ed integrato di default.
104
+
=======
105
+
+ Full integration with HTML/CSS.
106
+
+ Simple things are done simply.
107
+
+ Supported by all major browsers and enabled by default.
108
+
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
91
109
```
92
110
JavaScript è l'unica tecnologia in ambiente browser che combina queste tre caratteristiche.
93
111
@@ -118,6 +136,12 @@ Ce ne sono molti altri. Ovviamente, per comprendere cosa stiamo facendo, se util
118
136
119
137
## Riepilogo
120
138
139
+
<<<<<<< HEAD
121
140
- JavaScript è stato creato specificamente per i browser, ma attualmente viene utilizzato con efficacia in molti altri ambienti.
122
141
- Attualmente, per quanto riguarda lo sviluppo del web, JavaScript si trova in una posizione unica grazie ad una completa integrazione con HTML/CSS.
123
142
- Ci sono molti linguaggi che possono essere "convertiti" in JavaScript; essi provvedono le stesse funzionalità e risolvono gli stessi problemi. E' fortemente consigliato di leggere brevemente le funzionalità di alcuni di essi, dopo avert studiato e compreso JavaScript.
143
+
=======
144
+
- JavaScript was initially created as a browser-only language, but it is now used in many other environments as well.
145
+
- Today, JavaScript has a unique position as the most widely-adopted browser language, fully integrated with HTML/CSS.
146
+
- There are many languages that get "transpiled" to JavaScript and provide certain features. It is recommended to take a look at them, at least briefly, after mastering JavaScript.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/01-hello-world/article.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,11 @@ Il file dello script viene integrato nel codice HTML tramite l'attributo `src`:
71
71
<scriptsrc="/path/to/script.js"></script>
72
72
```
73
73
74
+
<<<<<<< HEAD
74
75
Questo `/path/to/script.js` è il percorso assoluto al file che contiene lo script a partire dalla root del sito. Ad esempio, `src="script.js"` significherebbe un file `"script.js"` che si trova nella cartella corrente.
76
+
=======
77
+
Here, `/path/to/script.js` is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"`, just like `src="./script.js"`, would mean a file `"script.js"` in the current folder.
78
+
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
75
79
76
80
E' anche possibile fornire un percorso relativo a partire dalla pagina corrente. Per esempio `src="script.js"` significa che il file `"script.js"` si trova nella cartella corrente.
Le ultime tre linee potrebbero richiedere una spiegazione ulteriore:
250
254
255
+
<<<<<<< HEAD
251
256
1. `Math` è un oggetto integrato che fornisce operazioni matematiche avanzate. Lo studieremo nel capitolo <info:number>. Qui ha il semplice scopo di rappresentare un oggetto.
252
257
2. Il risultato di `typeof null` è `"object"`. Questo è un errore del linguaggio, ufficialmente riconosciuto e mantenuto per retro-compatibilità. Ovviamente, `null` non è un oggetto. E' un valore speciale che fa da tipo a se stesso. Quindi, nuovamente, questo è un errore del linguaggio.
253
258
3. Il risultato di `typeof alert` è `"function"`, poiché `alert` è una funzione del linguaggio. Studieremo le funzioni nel prossimo capitolo, e vedremo che non c'e nessun tipo "funzione" nel linguaggio. Le funzioni appartengono al tipo oggetto. Ma `typeof` le tratta differentemente. Formalmente, è errato, ma molto utile nella pratica.
254
259
255
260
## Riepilogo
261
+
=======
262
+
1. `Math` is a built-in object that provides mathematical operations. We will learn it in the chapter <info:number>. Here, it serves just as an example of an object.
263
+
2. The result of `typeof null` is `"object"`. That's an officially recognized error in`typeof`, coming from very early days of JavaScript and kept forcompatibility. Definitely, `null` is not an object. It is a special value with a separate type of its own. The behavior of`typeof` is wrong here.
264
+
3. The result of`typeof alert` is `"function"`, because `alert` is a function. We'll study functions in the next chapters where we'll also see that there's no special "function" type in JavaScript. Functions belong to the object type. But `typeof` treats them differently, returning `"function"`. That also comes from the early days of JavaScript. Technically, such behavior isn't correct, but can be convenient in practice.
265
+
266
+
```smart header="The `typeof(x)` syntax"
267
+
You may also come across another syntax: `typeof(x)`. It's the same as `typeof x`.
268
+
269
+
To put it clear: `typeof` is an operator, not a function. The parentheses here aren't a part of `typeof`. It's the kind of parentheses used for mathematical grouping.
270
+
271
+
Usually, such parentheses contain a mathematical expression, such as `(2 + 2)`, but here they contain only one argument `(x)`. Syntactically, they allow to avoid a space between the `typeof` operator and its argument, and some people like it.
272
+
273
+
Some people prefer `typeof(x)`, although the `typeof x` syntax is much more common.
274
+
```
275
+
276
+
## Summary
277
+
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
256
278
257
279
Ci sono 7 tipi base in JavaScript.
258
280
@@ -267,8 +289,14 @@ Ci sono 7 tipi base in JavaScript.
267
289
268
290
L'operatore `typeof` ci consente di vedere quale tipo è memorizzato nella variabile.
269
291
292
+
<<<<<<< HEAD
270
293
- Due forme: `typeof x` o `typeof(x)`.
271
294
- Ritorna una stringa con il nome del tipo, come `"string"`.
272
295
- Il valore `null` ritorna `"object"` -- è un errore del linguaggio, infatti non è un oggetto.
296
+
=======
297
+
- Usually used as `typeof x`, but `typeof(x)` is also possible.
298
+
- Returns a string with the name of the type, like `"string"`.
299
+
- For `null` returns `"object"` -- this is an error in the language, it's not actually an object.
300
+
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
273
301
274
302
Nel prossimo capitolo ci concentreremo nei tipi primitivi e quando avremo preso familiarità, passeremo agli oggetti.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/09-comparison/article.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,14 @@ Molti operatori di confronto già li conosciamo dalla matematica:
7
7
- Uguaglianza: `a == b` (da notare che il doppio simbolo `=` indica un test di uguaglianza, mentre il simbolo unico `a = b` rappresenta un' assegnazione).
8
8
- Disuguaglianza. In matematica la notazione è <code>≠</code>, mentre in JavaScript viene scritto come <code>a != b</code>.
9
9
10
+
<<<<<<< HEAD
10
11
In questo articolo impareremo più approfonditamente i vari tipi di confronto, come vengono gestiti in JavaScript, incluse alcune importanti peculiarità
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/11-logical-operators/article.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,8 +121,16 @@ Questo ci permette alcuni utilizzi interessanti rispetto al "puro e classico OR
121
121
122
122
Gli operandi, oltre che valori, possono essere anche espressioni arbitrarie. L'operatore OR esegue la valutazione da sinistra a destra e si ferma al primo risultato vero, il quale viene ritornato. Il processo è chiamato "valutazione a corto-circuito" perché cerca di concludersi il prima possibile, senza dover elaborare tutti gli operandi.
123
123
124
+
<<<<<<< HEAD
124
125
Il logical OR è particolarmente utile quando il secondo argomento causerebbe un *side-effect* come l'assegnazione di una variabile o la chiamata a una funzione.
125
126
Nell'esempio che segue solo il secondo messaggio verrà mostrato.
127
+
=======
128
+
It means that `||` processes its arguments until the first truthy value is reached, and then the value is returned immediately, without even touching the other argument.
129
+
130
+
The importance of this feature becomes obvious if an operand isn't just a value, but an expression with a side effect, such as a variable assignment or a function call.
131
+
132
+
In the example below, only the second message is printed:
Nell'esempio sopra, si potrebbe dire: "la funzione `showMessage` è dichiarata con due parametri, quindi viene chiamata con due argomenti: `from` and `"Hello"`".
187
+
=======
188
+
In the example above, one might say: "the function `showMessage` is declared with two parameters, then called with two arguments: `from` and `"Hello"`".
0 commit comments