Skip to content

Commit

Permalink
merging all conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
iliakan committed Dec 20, 2021
2 parents f9f0b4d + 8d04d0d commit 2e59488
Show file tree
Hide file tree
Showing 84 changed files with 954 additions and 66 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ sftp-config.json
Thumbs.db


/svgs
24 changes: 24 additions & 0 deletions 1-js/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ Il browser ha un suo motore JavaScript integrato, chiamato alle volte "JavaScrip

Esistono altri motori JavaScript, tra cui:

<<<<<<< HEAD
- [V8](https://en.wikipedia.org/wiki/V8_(JavaScript_engine)) -- per Chrome e Opera.
- [SpiderMonkey](https://en.wikipedia.org/wiki/SpiderMonkey) -- per Firefox.
- ...Ci sono altri codenames come "Chakra" per IE, "JavaScriptCore", "Nitro" e "SquirrelFish" per Safari, etc.

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.
=======
- [V8](https://en.wikipedia.org/wiki/V8_(JavaScript_engine)) -- in Chrome, Opera and Edge.
- [SpiderMonkey](https://en.wikipedia.org/wiki/SpiderMonkey) -- in Firefox.
- ...There are other codenames like "Chakra" for IE, "JavaScriptCore", "Nitro" and "SquirrelFish" for Safari, etc.

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.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
```smart header="Come funzionano questi motori?"
Expand Down Expand Up @@ -60,7 +68,11 @@ Ad esempio, è possibile:

## Cosa NON può fare JavaScript a livello browser?

<<<<<<< HEAD
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.
=======
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.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
Esempi di queste restrizioni possono essere:

Expand All @@ -85,9 +97,15 @@ Queste limitazioni non si pongono se JavaScript viene eseguito fuori dal browser
Ci sono almeno *tre* cose che rendono JavaScript cosi unico:

```compare
<<<<<<< HEAD
+ Completa integrazione con HTML/CSS.
+ Operazioni semplici vengono eseguite semplicemente.
+ Supportato dai maggiori browser ed integrato di default.
=======
+ Full integration with HTML/CSS.
+ Simple things are done simply.
+ Supported by all major browsers and enabled by default.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
```
JavaScript è l'unica tecnologia in ambiente browser che combina queste tre caratteristiche.

Expand Down Expand Up @@ -118,6 +136,12 @@ Ce ne sono molti altri. Ovviamente, per comprendere cosa stiamo facendo, se util

## Riepilogo

<<<<<<< HEAD
- JavaScript è stato creato specificamente per i browser, ma attualmente viene utilizzato con efficacia in molti altri ambienti.
- Attualmente, per quanto riguarda lo sviluppo del web, JavaScript si trova in una posizione unica grazie ad una completa integrazione con HTML/CSS.
- 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.
=======
- JavaScript was initially created as a browser-only language, but it is now used in many other environments as well.
- Today, JavaScript has a unique position as the most widely-adopted browser language, fully integrated with HTML/CSS.
- 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.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
7 changes: 7 additions & 0 deletions 1-js/01-getting-started/3-code-editors/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ In pratica, tuttavia, gli editor semplici possono avere molti plugin, tra cui la

Meritano attenzione le seguenti opzioni:

<<<<<<< HEAD
- [Atom](https://atom.io/) (*cross-platform*, gratuito).
- [Visual Studio Code](https://code.visualstudio.com/) (*cross-platform*, gratuito).
- [Sublime Text](http://www.sublimetext.com) (*cross-platform*, con prova gratuita).
- [Notepad++](https://notepad-plus-plus.org/) (Windows, gratuito).
- [Vim](http://www.vim.org/) e [Emacs](https://www.gnu.org/software/emacs/) sono particolarmente carini se si sanno utilizzare.
=======
- [Atom](https://atom.io/) (cross-platform, free).
- [Sublime Text](http://www.sublimetext.com) (cross-platform, shareware).
- [Notepad++](https://notepad-plus-plus.org/) (Windows, free).
- [Vim](http://www.vim.org/) and [Emacs](https://www.gnu.org/software/emacs/) are also cool if you know how to use them.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
## Non intestarditevi

Expand Down
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/01-hello-world/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ Il file dello script viene integrato nel codice HTML tramite l'attributo `src`:
<script src="/path/to/script.js"></script>
```

<<<<<<< HEAD
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.
=======
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.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
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.

Expand Down
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/04-variables/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ Adesso possiamo inserirci dei dati utilizzando l'operatore di assegnazione `=`:
let message;

*!*
<<<<<<< HEAD
message = 'Hello'; // memorizzazione della stringa
=======
message = 'Hello'; // store the string 'Hello' in the variable named message
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
*/!*
```

Expand Down
28 changes: 28 additions & 0 deletions 1-js/02-first-steps/05-types/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,16 @@ L'operatore `typeof` ritorna il tipo dell'argomento. E' utile quando vogliamo la

Sono supportate due sintassi:

<<<<<<< HEAD
1. Come operatore: `typeof x`.
2. Come funzione: `typeof(x)`.

In altre parole, funziona sia con le parentesi che senza. Il risultato è lo stesso.

Una chiamata a `typeof x` ritorna una stringa con il nome del tipo:
=======
A call to `typeof x` returns a string with the type name:
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
```js
typeof undefined // "undefined"
Expand Down Expand Up @@ -248,11 +252,29 @@ typeof alert // "function" (3)

Le ultime tre linee potrebbero richiedere una spiegazione ulteriore:

<<<<<<< HEAD
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.
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.
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.

## Riepilogo
=======
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.
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 for compatibility. 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.
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.

```smart header="The `typeof(x)` syntax"
You may also come across another syntax: `typeof(x)`. It's the same as `typeof x`.

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.

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.

Some people prefer `typeof(x)`, although the `typeof x` syntax is much more common.
```
## Summary
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
Ci sono 7 tipi base in JavaScript.
Expand All @@ -267,8 +289,14 @@ Ci sono 7 tipi base in JavaScript.
L'operatore `typeof` ci consente di vedere quale tipo è memorizzato nella variabile.
<<<<<<< HEAD
- Due forme: `typeof x` o `typeof(x)`.
- Ritorna una stringa con il nome del tipo, come `"string"`.
- Il valore `null` ritorna `"object"` -- è un errore del linguaggio, infatti non è un oggetto.
=======
- Usually used as `typeof x`, but `typeof(x)` is also possible.
- Returns a string with the name of the type, like `"string"`.
- For `null` returns `"object"` -- this is an error in the language, it's not actually an object.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
Nel prossimo capitolo ci concentreremo nei tipi primitivi e quando avremo preso familiarità, passeremo agli oggetti.
7 changes: 7 additions & 0 deletions 1-js/02-first-steps/09-comparison/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ Molti operatori di confronto già li conosciamo dalla matematica:
- Uguaglianza: `a == b` (da notare che il doppio simbolo `=` indica un test di uguaglianza, mentre il simbolo unico `a = b` rappresenta un' assegnazione).
- Disuguaglianza. In matematica la notazione è <code>&ne;</code>, mentre in JavaScript viene scritto come <code>a != b</code>.

<<<<<<< HEAD
In questo articolo impareremo più approfonditamente i vari tipi di confronto, come vengono gestiti in JavaScript, incluse alcune importanti peculiarità
=======
- Greater/less than: <code>a &gt; b</code>, <code>a &lt; b</code>.
- Greater/less than or equals: <code>a &gt;= b</code>, <code>a &lt;= b</code>.
- Equals: `a == b`, please note the double equality sign `==` means the equality test, while a single one `a = b` means an assignment.
- Not equals: In maths the notation is <code>&ne;</code>, but in JavaScript it's written as <code>a != b</code>.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
## Il risultato è booleano

Expand Down
8 changes: 8 additions & 0 deletions 1-js/02-first-steps/11-logical-operators/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,16 @@ Questo ci permette alcuni utilizzi interessanti rispetto al "puro e classico OR

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.

<<<<<<< HEAD
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.
Nell'esempio che segue solo il secondo messaggio verrà mostrato.
=======
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.

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.

In the example below, only the second message is printed:
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
```js run no-beautify
*!*true*/!* || alert("not printed");
Expand Down
13 changes: 13 additions & 0 deletions 1-js/02-first-steps/13-while-for/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,19 @@ Esaminiamo l'istruzione `for` parte per parte:

| Parte | | |
|-------|----------|----------------------------------------------------------------------------|
<<<<<<< HEAD
| begin | `i = 0` | Viene eseguito una volta sola, all'entrata nel ciclo. |
| condition | `i < 3`| Viene controllata prima di ogni iterazione; se falsa, il ciclo si interrompe.|
| body | `alert(i)`| Viene eseguito fino a quando la condizione è vera.
| step| `i++` | Viene eseguito ad ogni iterazione, dopo il corpo, fintato che la condizione è `true`.|
=======
| begin | `let i = 0` | Executes once upon entering the loop. |
| condition | `i < 3`| Checked before every loop iteration. If false, the loop stops. |
| body | `alert(i)`| Runs again and again while the condition is truthy. |
| step| `i++` | Executes after the body on each iteration. |

The general loop algorithm works like this:
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
L'iterazione, generalmente, funziona nel modo seguente:
```
Expand Down Expand Up @@ -379,7 +388,11 @@ label: {
}
```
<<<<<<< HEAD
...Comunque, nel 99.9% dei casi, `break` viene usato nei cicli, come abbiamo visto negli esempi precedenti.
=======
...Although, 99.9% of the time `break` is used inside loops, as we've seen in the examples above.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
La chiamata a `continue` è possibile solo dall'interno di un ciclo
````
Expand Down
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/15-function-basics/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ In other words, per chiarire questi termini:

Dichiariamo le funzioni elencando i loro parametri, quindi le chiamiamo passando gli argomenti.

<<<<<<< HEAD
Nell'esempio sopra, si potrebbe dire: "la funzione `showMessage` è dichiarata con due parametri, quindi viene chiamata con due argomenti: `from` and `"Hello"`".
=======
In the example above, one might say: "the function `showMessage` is declared with two parameters, then called with two arguments: `from` and `"Hello"`".
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
## Valori di default
Expand Down
34 changes: 33 additions & 1 deletion 1-js/02-first-steps/16-function-expressions/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,39 @@ function sayHi() {

E' disponibile un'altra sintassi per creare una funzione, chiamata *function expression*.

<<<<<<< HEAD
La sintassi:
=======
It allows to create a new function in the middle of any expression.

For example:
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
```js
let sayHi = function() {
alert( "Hello" );
};
```

<<<<<<< HEAD
Qui la funzione viene esplicitamente creata ed assegnata ad una variabile, proprio come un qualsiasi altro valore. Non ha importanza come la funzione viene definita, è solo un valore salvato nella variabile `sayHi`.

Il significato di questo esempio è lo stesso di: "crea una funzione e mettila dentro la variabile `sayHi`".
=======
Here we can see a variable `sayHi` getting a value, the new function, created as `function() { alert("Hello"); }`.

As the function creation happens in the context of the assignment expression (to the right side of `=`), this is a *Function Expression*.

Please note, there's no name after the `function` keyword. Omitting a name is allowed for Function Expressions.

Here we immediately assign it to the variable, so the meaning of these code samples is the same: "create a function and put it into the variable `sayHi`".

In more advanced situations, that we'll come across later, a function may be created and immediately called or scheduled for a later execution, not stored anywhere, thus remaining anonymous.

## Function is a value

Let's reiterate: no matter how the function is created, a function is a value. Both examples above store a function is `sayHi` variable.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
Possiamo anche mostrarne il valore usando `alert`:

Expand Down Expand Up @@ -62,13 +84,17 @@ Quello che succede, nel dettaglio, è:
1. La dichiarazione di funzione `(1)` crea la funzione e la inserisce nella variabile denominata `sayHi`.
2. La linea `(2)` la copia nella variabile `func`.

<<<<<<< HEAD
Ancora una volta: non ci sono parentesi dopo `sayHi`. Se ci fossero state, allora `func = sayHi()` avrebbe inserito *il risultato della chiamata* `sayHi()`, non *la funzione* `sayHi`.
3. Adesso la funzione può essere richiamata sia con `sayHi()` che con `func()`.

Avremmo anche potuto utilizzare, nella prima riga, una function expression per dichiarare `sayHi`:
=======
We could also have used a Function Expression to declare `sayHi`, in the first line:
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
```js
let sayHi = function() {
let sayHi = function() { // (1) create
alert( "Hello" );
};

Expand All @@ -92,9 +118,15 @@ let sayHi = function() {
}*!*;*/!*
```
<<<<<<< HEAD
La risposta è semplice:
- Non c'è bisogno di `;` alla fine dei blocchi di codice che utilizzano una sintassi del tipo `if { ... }`, `for { }`, `function f { }` etc.
- Una function expression viene utilizzata all'interno di un'istruzione: `let sayHi = ...;`, come valore. Non è un blocco di codice. Quindi il `;` è consigliato al termine dell'istruzione, indipendentemente dal valore. Il punto e virgola non è collegato alla function expression; più semplicemente, termina un'istruzione.
=======
The answer is simple: a Function Expression is created here as `function(…) {…}` inside the assignment statement: `let sayHi = …;`. The semicolon `;` is recommended at the end of the statement, it's not a part of the function syntax.
The semicolon would be there for a simpler assignment, such as `let sayHi = 5;`, and it's also there for a function assignment.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
````

## Callback functions (funzioni richiamate)
Expand Down
6 changes: 5 additions & 1 deletion 1-js/02-first-steps/17-arrow-functions-basics/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ Esiste un'altra sintassi molto semplice e concisa per creare funzioni e che spes
E' chiamata "arrow functions", perché si presenta in questo modo:

```js
let func = (arg1, arg2, ..., argN) => expression
let func = (arg1, arg2, ..., argN) => expression;
```

<<<<<<< HEAD
Questo codice crea una funzione `func` che accetta gli argomenti `arg1..argN` e li utilizza per valutare `expression` e restituirne il risultato.
=======
This creates a function `func` that accepts arguments `arg1..argN`, then evaluates the `expression` on the right side with their use and returns its result.
>>>>>>> 8d04d0d2db97276dbb2b451c30a7bd3e05d65831
In altre parole è una versione abbreviata di:

Expand Down

0 comments on commit 2e59488

Please sign in to comment.