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
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,12 @@ I nomi citati sopra possono essere utili da ricordare, poiché si possono trovar
34
34
35
35
Il funzionamento di questi motori è complicato, ma i concetti alla base sono semplici.
36
36
37
+
<<<<<<< HEAD
38
+
=======
39
+
1. The engine (embedded if it's a browser) reads ("parses") the script.
40
+
2. Then it converts ("compiles") the script to machine code.
41
+
3. And then the machine code runs, pretty fast.
42
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
37
43
38
44
1. I motori (integrati nei browser) leggono ("analizzano") lo script.
39
45
2. Successivamente convertono ("compilano") lo script nel linguaggio della macchina.
@@ -44,7 +50,11 @@ Il motore ottimizza il codice ad ogni passaggio del processo, anche durante l'es
44
50
45
51
## Cosa può fare JavaScript a livello browser?
46
52
53
+
<<<<<<< HEAD
47
54
JavaScript, al giorno d'oggi, è un linguaggio di programmazione "sicuro". Non consente alcun accesso di basso livello alla memoria o alla CPU. Questo perché è stato creato con lo scopo di funzionare nei browser, che non richiedono questi tipi di privilegi.
55
+
=======
56
+
Modern JavaScript is a "safe" programming language. It does not provide low-level access to memory or the CPU, because it was initially created for browsers which do not require it.
57
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
48
58
49
59
Le capacità di JavaScript dipendono molto dall'ambiente in cui lo si esegue. Ad esempio, [Node.js](https://wikipedia.org/wiki/Node.js) supporta funzioni che consentono a JavaScript di scrivere/leggere file, eseguire richieste web, etc.
50
60
@@ -60,14 +70,19 @@ Ad esempio, è possibile:
60
70
61
71
## Cosa NON può fare JavaScript a livello browser?
62
72
73
+
<<<<<<< HEAD
63
74
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.
75
+
=======
76
+
JavaScript's abilities in the browser are limited to protect the user's safety. The aim is to prevent an evil webpage from accessing private information or harming the user's data.
77
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
64
78
65
79
Esempi di queste restrizioni possono essere:
66
80
67
81
- JavaScript, in una pagina web, non può leggere o scrivere in qualsiasi file nell'hard disk, né copiare o eseguire programmi. Non ha accesso diretto alle funzioni del sistema operativo.
68
82
69
83
I moderni browser gli consentono di lavorare con i file, sempre con un accesso limitato e comunque solo se il comando proviene da utente, come il "dropping" di un file nella finestra del browser, o con la selezione tramite il tag `<input>`.
70
84
85
+
<<<<<<< HEAD
71
86
Ci sono anche funzionalità che consentono di interagire con la camera/microfono e altri dispositivi, ma in ogni caso richiedono il permesso esplicito dell'utente. Quindi una pagina con JavaScript abilitato non può attivare la web-cam di nascosto, osservare i nostri comportamenti e inviare informazioni alla [CIA](https://it.wikipedia.org/wiki/Central_Intelligence_Agency).
72
87
- Pagine o schede diverse generalmente non sono a conoscenza dell'esistenza delle altre. In certi casi, tuttavia, può capitare; ad esempio quando una finestra ne apre un'altra tramite JavaScript. Ma anche in questo caso, il codice JavaScript non può accedere all'altra pagina se non appartiene allo stesso sito (stesso dominio, protocollo o porta).
73
88
@@ -79,6 +94,19 @@ Esempi di queste restrizioni possono essere:
79
94

80
95
81
96
Queste limitazioni non si pongono se JavaScript viene eseguito fuori dal browser, ad esempio in un server. I browser moderni permettono l'installazione di plugin ed estensioni che consentono di estendere vari permessi.
97
+
=======
98
+
There are ways to interact with the camera/microphone and other devices, but they require a user's explicit permission. So a JavaScript-enabled page may not sneakily enable a web-camera, observe the surroundings and send the information to the [NSA](https://en.wikipedia.org/wiki/National_Security_Agency).
99
+
- Different tabs/windows generally do not know about each other. Sometimes they do, for example when one window uses JavaScript to open the other one. But even in this case, JavaScript from one page may not access the other page if they come from different sites (from a different domain, protocol or port).
100
+
101
+
This is called the "Same Origin Policy". To work around that, *both pages* must agree for data exchange and must contain special JavaScript code that handles it. We'll cover that in the tutorial.
102
+
103
+
This limitation is, again, for the user's safety. A page from `http://anysite.com` which a user has opened must not be able to access another browser tab with the URL `http://gmail.com`, for example, and steal information from there.
104
+
- JavaScript can easily communicate over the net to the server where the current page came from. But its ability to receive data from other sites/domains is crippled. Though possible, it requires explicit agreement (expressed in HTTP headers) from the remote side. Once again, that's a safety limitation.
105
+
106
+

107
+
108
+
Such limitations do not exist if JavaScript is used outside of the browser, for example on a server. Modern browsers also allow plugins/extensions which may ask for extended permissions.
109
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
82
110
83
111
## Cosa rende JavaScript unico?
84
112
@@ -93,20 +121,29 @@ JavaScript è l'unica tecnologia in ambiente browser che combina queste tre cara
93
121
94
122
Questo rende JavaScript unico. Ed è il motivo per cui è lo strumento più diffuso per creare interfacce web.
95
123
124
+
<<<<<<< HEAD
96
125
Quando si ha in programma di imparare una nuova tecnologia, è fondamentale verificare le sue prospettive. Quindi diamo uno sguardo alle nuove tendenze che includono nuovi linguaggi e tecnologie.
126
+
=======
127
+
That said, JavaScript can be used to create servers, mobile applications, etc.
128
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
97
129
98
130
## Linguaggi "oltre" JavaScript
99
131
100
132
La sintassi di JavaScript non soddisfa le necessità di tutti. Alcune persone necessitano di caratteristiche differenti.
101
133
102
134
Questo è prevedibile, poiché i progetti e i requisiti sono diversi da persona a persona.
103
135
136
+
<<<<<<< HEAD
104
137
Recentemente, per questo motivo, sono nati molti nuovi linguaggi che vengono *convertiti* in JavaScript prima di essere eseguiti nel browser.
138
+
=======
139
+
So, recently a plethora of new languages appeared, which are *transpiled* (converted) to JavaScript before they run in the browser.
140
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
105
141
106
142
Gli strumenti moderni rendono la conversione molto veloce e pulita, consentendo agli sviluppatori di programmare in un altro linguaggio e di auto-convertirlo *under the hood*.
107
143
108
144
Esempi di alcuni linguaggi:
109
145
146
+
<<<<<<< HEAD
110
147
-[CoffeeScript](http://coffeescript.org/) è un linguaggio che introduce una sintassi semplificata che consente di scrivere codice più leggibile. Amato dagli sviluppatori provenienti da Ruby.
111
148
-[TypeScript](http://www.typescriptlang.org/) si occupa di aggiungere la "tipizzazione", per semplificare lo sviluppo e supportare sistemi più complessi. E' stato sviluppato da Microsoft.
112
149
-[Flow](http://flow.org/) anche'esso aggiunge la tipizzazione dei dati, ma in un modo differente. Sviluppato da Facebook.
@@ -115,6 +152,16 @@ Esempi di alcuni linguaggi:
115
152
-[Kotlin](https://kotlinlang.org/docs/reference/js-overview.html) è un moderno, conciso e sicuro linguaggio di programmazione mirato ai browsers o a Node.
116
153
117
154
Ce ne sono molti altri. Ovviamente, per comprendere cosa stiamo facendo, se utilizziamo uno di questi linguaggi dovremmo altresì conoscere JavaScript.
155
+
=======
156
+
-[CoffeeScript](https://coffeescript.org/) is "syntactic sugar" for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it.
157
+
-[TypeScript](https://www.typescriptlang.org/) is concentrated on adding "strict data typing" to simplify the development and support of complex systems. It is developed by Microsoft.
158
+
-[Flow](https://flow.org/) also adds data typing, but in a different way. Developed by Facebook.
159
+
-[Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google.
160
+
-[Brython](https://brython.info/) is a Python transpiler to JavaScript that enables the writing of applications in pure Python without JavaScript.
161
+
-[Kotlin](https://kotlinlang.org/docs/reference/js-overview.html) is a modern, concise and safe programming language that can target the browser or Node.
162
+
163
+
There are more. Of course, even if we use one of these transpiled languages, we should also know JavaScript to really understand what we're doing.
Copy file name to clipboardExpand all lines: 1-js/01-getting-started/2-manuals-specifications/article.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,23 @@
1
1
2
2
# Manuali e Specifiche
3
3
4
+
<<<<<<< HEAD
4
5
Questo libro è un *tutorial*. L'obiettivo è quello di aiutarti ad apprender il linguaggio gradualmente. Una volta che avrai familiarizzato con le basi avrai bisogno di ulteriori risorse.
6
+
=======
7
+
This book is a *tutorial*. It aims to help you gradually learn the language. But once you're familiar with the basics, you'll need other resources.
8
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
5
9
6
10
## Specifiche
7
11
8
12
[La specifica ECMA-262](https://www.ecma-international.org/publications/standards/Ecma-262.htm) contiene informazioni più dettagliate, approfondite e formalizzate riguardanti JavaScript. E' la definizione stessa del linguaggio.
9
13
10
14
Iniziare a studiare dalla specifica può risultare difficile. Se avete bisogno di una fonte affidabile e formale riguardante i dettagli del linguaggio, la specifica è il posto in cui cercare. Ma non è una risorsa comoda da consultare per i problemi di tutti i giorni.
11
15
16
+
<<<<<<< HEAD
12
17
Ogni anno viene rilasciata una nuova specifica. Di queste pubblicazioni, è possibile trovare l'ultima bozza a <https://tc39.es/ecma262/>.
18
+
=======
19
+
A new specification version is released every year. Between these releases, the latest specification draft is at <https://tc39.es/ecma262/>.
20
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
13
21
14
22
Per leggere delle più recenti caratteristiche, incluse quelle considerate "quasi standard" (definite "stage 3"), potete consultare <https://github.com/tc39/proposals>.
15
23
@@ -19,16 +27,29 @@ Inoltre, se state sviluppando in ambiente browser, ci sono ulteriori specifiche
19
27
20
28
-**MDN (Mozilla) JavaScript Reference** è il manuale principale, corredato di spiegazioni teoriche, esempi ed altre informazioni utili. E' ottimo per avere informazioni dettagliate riguardo le funzioni e altre caratteristiche del linguaggio.
21
29
30
+
<<<<<<< HEAD
22
31
Può essere consultato a <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.
23
32
24
33
Tuttavia, spesso è meglio fare una ricerca su internet. E' sufficiente cercare "MDN", seguito dal termine da ricercare, e.g. <https://google.com/search?q=MDN+parseInt> per ricercare la funzione `parseInt`, oppure frasi come "RegExp MSDN" o "RegExp MSDN jscript".
34
+
=======
35
+
You can find it at <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.
36
+
37
+
Although, it's often best to use an internet search instead. Just use "MDN [term]" in the query, e.g. <https://google.com/search?q=MDN+parseInt> to search for the `parseInt` function.
38
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
25
39
26
40
27
41
Può essere consultato al link <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.
28
42
29
43
-**MSDN** – Manuale Microsoft con molte informazioni, tra cui su JavaScript (a cui viene fatto riferimento con il termine JScript). Se si ha bisogno di ottenere qualche informazione specifica per Internet Explorer, meglio consultare la guida: <http://msdn.microsoft.com/>.
30
44
45
+
<<<<<<< HEAD
46
+
47
+
=======
48
+
-<https://caniuse.com> - per-feature tables of support, e.g. to see which engines support modern cryptography functions: <https://caniuse.com/#feat=cryptography>.
49
+
-<https://kangax.github.io/compat-table> - a table with language features and engines that support those or don't support.
31
50
51
+
All these resources are useful in real-life development, as they contain valuable information about language details, their support, etc.
Per Windows, c'è anche l'editor "Visual Studio", da non confondere con "Visual Studio Code". "Visual Studio" è un potente editor (a pagamento) disponibile solo per Windows, ottimo per le piattaforme .NET. E' disponibile anche una versione gratuita: ([Visual Studio Community](https://www.visualstudio.com/vs/community/).
19
24
@@ -29,18 +34,35 @@ La principale differenza tra gli editor semplici e un IDE è che quest'ultimo la
29
34
30
35
In pratica, tuttavia, gli editor semplici possono avere molti plugin, tra cui la sintassi a livello directory e l'autocompletamento, quindi non ci sono delle differenze ben definite tra un editor semplice e un IDE.
-[Vim](https://www.vim.org/) and [Emacs](https://www.gnu.org/software/emacs/) are also cool if you know how to use them.
51
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
39
52
40
53
## Non intestarditevi
41
54
42
55
Gli editor elencanti sopra sono quelli che io e i miei amici, che considero buoni sviluppatori, abbiamo utilizzato senza problemi per molto tempo.
43
56
44
57
Ci sono altri grandi editor nel nostro grande mondo. Scegli quello che più ti si addice.
45
58
59
+
<<<<<<< HEAD
46
60
La scelta di un editor, come pure di altri strumenti, è individuale e dipende dai progetti, dalle abitudini e preferenze personali.
61
+
=======
62
+
The choice of an editor, like any other tool, is individual and depends on your projects, habits, and personal preferences.
63
+
64
+
The author's personal opinion:
65
+
66
+
- I'd use [Visual Studio Code](https://code.visualstudio.com/) if I develop mostly frontend.
67
+
- Otherwise, if it's mostly another language/platform and partially frontend, then consider other editors, such as XCode (Mac), Visual Studio (Windows) or Jetbrains family (Webstorm, PHPStorm, RubyMine etc, depending on the language).
Abbiamo una costante `birthday` che indica una data e `age` che viene calcolata da `birthday` tramite un algoritmo (non viene fornito per brevità, e perchè non è importante per descrivere l'argomento).
17
+
=======
18
+
Here we have a constant `birthday` for the date, and also the `age` constant.
19
+
20
+
The `age` is calculated from `birthday` using `someCode()`, which means a function call that we didn't explain yet (we will soon!), but the details don't matter here, the point is that `age` is calculated somehow based on the `birthday`.
21
+
>>>>>>> b258d7d5b635c88228f7556e14fbe5e5ca7f736d
16
22
17
23
Sarebbe giusto utilizzare lettere maiuscole per `birthday`? E per `age`? O anche per entrambe?
18
24
19
25
```js
20
-
constBIRTHDAY='18.04.1982'; // make uppercase?
26
+
constBIRTHDAY='18.04.1982'; // make birthday uppercase?
21
27
22
-
constAGE=someCode(BIRTHDAY); // make uppercase?
28
+
constAGE=someCode(BIRTHDAY); // make age uppercase?
0 commit comments