This commit is contained in:
parent
2049a029f2
commit
3daeea726d
@ -1,5 +1,5 @@
|
|||||||
|
<h1><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
# 🎓 JavaScript
|
<i class="fab fa-js-square fa-2x" style="color: #f7df1e;"></i> Javascript</h1>
|
||||||
|
|
||||||
## 📘 Théorie de base
|
## 📘 Théorie de base
|
||||||
|
|
||||||
@ -75,15 +75,15 @@ if (nom) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## 1. 🌱 Les bases de JavaScript
|
## 🌱 Les bases de JavaScript
|
||||||
|
|
||||||
### 1.1 Intégration dans une page HTML
|
### Intégration dans une page HTML
|
||||||
``` { .html .copy }
|
``` { .html .copy }
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Mon script</title>
|
<title>Mon script</title>
|
||||||
<script src="script. { .js .copy }" defer></script>
|
<script src="script.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Hello World</h1>
|
<h1>Hello World</h1>
|
||||||
@ -98,14 +98,14 @@ Ou directement dans une balise `<script>` :
|
|||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.2 Variables
|
### Variables
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
let nom = "Alice"; // variable modifiable
|
let nom = "Alice"; // variable modifiable
|
||||||
const PI = 3.14; // constante
|
const PI = 3.14; // constante
|
||||||
var age = 30; // ancienne syntaxe, à éviter
|
var age = 30; // ancienne syntaxe, à éviter
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.3 Types de données
|
### Types de données
|
||||||
- `string` : `"Bonjour"`
|
- `string` : `"Bonjour"`
|
||||||
- `number` : `42`, `3.14`
|
- `number` : `42`, `3.14`
|
||||||
- `boolean` : `true`, `false`
|
- `boolean` : `true`, `false`
|
||||||
@ -113,7 +113,7 @@ var age = 30; // ancienne syntaxe, à éviter
|
|||||||
- `null`
|
- `null`
|
||||||
- `object`, `array`, `function`
|
- `object`, `array`, `function`
|
||||||
|
|
||||||
### 1.4 Opérateurs
|
### Opérateurs
|
||||||
- Arithmétiques : `+`, `-`, `*`, `/`, `%`
|
- Arithmétiques : `+`, `-`, `*`, `/`, `%`
|
||||||
- Comparaison : `==`, `===`, `!=`, `!==`, `<`, `>`, `<=`, `>=`
|
- Comparaison : `==`, `===`, `!=`, `!==`, `<`, `>`, `<=`, `>=`
|
||||||
- Logiques : `&&`, `||`, `!`
|
- Logiques : `&&`, `||`, `!`
|
||||||
@ -138,9 +138,9 @@ var age = 30; // ancienne syntaxe, à éviter
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 2. Contrôle de flux
|
## Contrôle de flux
|
||||||
|
|
||||||
### 2.1 Conditions
|
### Conditions
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
if (age > 18) {
|
if (age > 18) {
|
||||||
console.log("Majeur");
|
console.log("Majeur");
|
||||||
@ -154,7 +154,7 @@ Opérateur ternaire :
|
|||||||
let message = (age > 18) ? "Majeur" : "Mineur";
|
let message = (age > 18) ? "Majeur" : "Mineur";
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2.2 Boucles
|
### Boucles
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 5; i++) {
|
||||||
console.log(i);
|
console.log(i);
|
||||||
@ -169,7 +169,7 @@ while (i < 5) {
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 3. Fonctions
|
## Fonctions
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
function saluer(nom) {
|
function saluer(nom) {
|
||||||
return `Bonjour ${nom}`;
|
return `Bonjour ${nom}`;
|
||||||
@ -180,16 +180,16 @@ const direBonjour = (nom) => `Bonjour ${nom}`;
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 4. Tableaux et objets
|
## Tableaux et objets
|
||||||
|
|
||||||
### 4.1 Tableaux
|
### Tableaux
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
let fruits = ["pomme", "banane"];
|
let fruits = ["pomme", "banane"];
|
||||||
fruits.push("kiwi");
|
fruits.push("kiwi");
|
||||||
console.log(fruits[0]); // pomme
|
console.log(fruits[0]); // pomme
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4.2 Objets
|
### Objets
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
let personne = {
|
let personne = {
|
||||||
nom: "Alice",
|
nom: "Alice",
|
||||||
@ -205,9 +205,11 @@ personne.parler();
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 5. DOM (Document Object Model)
|
## DOM (Document Object Model)
|
||||||
|
|
||||||
### 5.1 Sélection des éléments
|
[Definition DOM](https://fr.wikipedia.org/wiki/Document_Object_Model)
|
||||||
|
|
||||||
|
### Sélection des éléments
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
const titre = document.querySelector("h1");
|
const titre = document.querySelector("h1");
|
||||||
```
|
```
|
||||||
@ -244,14 +246,14 @@ document.getElementById("incrementer").addEventListener("click", () => {
|
|||||||
|
|
||||||
## 6. Asynchrone et AJAX
|
## 6. Asynchrone et AJAX
|
||||||
|
|
||||||
### 6.1 setTimeout / setInterval
|
### setTimeout / setInterval
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log("1 seconde");
|
console.log("1 seconde");
|
||||||
}, 1000);
|
}, 1000);
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6.2 Promesses
|
### Promesses
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
fetch("https://api.example.com/data")
|
fetch("https://api.example.com/data")
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
@ -261,9 +263,9 @@ fetch("https://api.example.com/data")
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 7. Concepts avancés
|
## Concepts avancés
|
||||||
|
|
||||||
### 7.1 Closures
|
### Closures
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
function createCounter() {
|
function createCounter() {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
@ -274,7 +276,7 @@ const counter = createCounter();
|
|||||||
console.log(counter()); // 1
|
console.log(counter()); // 1
|
||||||
```
|
```
|
||||||
|
|
||||||
### 7.2 Classes
|
### Classes
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
class Animal {
|
class Animal {
|
||||||
constructor(nom) {
|
constructor(nom) {
|
||||||
@ -287,7 +289,7 @@ class Animal {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### 7.3 Modules (ES6)
|
### Modules (ES6)
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
// fichier.js
|
// fichier.js
|
||||||
export function addition(a, b) {
|
export function addition(a, b) {
|
||||||
@ -298,7 +300,7 @@ export function addition(a, b) {
|
|||||||
import { addition } from "./fichier. { .js .copy }";
|
import { addition } from "./fichier. { .js .copy }";
|
||||||
```
|
```
|
||||||
|
|
||||||
### 7.4 Async / Await
|
### Async / Await
|
||||||
``` { .js .copy }
|
``` { .js .copy }
|
||||||
async function getData() {
|
async function getData() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -8,36 +8,27 @@ Codium est la version open-source de Visual Studio Code.
|
|||||||
|
|
||||||
Le tutoriel vous permet d'installer Codium, Unity, et de relier un projet Unity avec Codium pour bénéficier de l'auto-complétion dans Codium.
|
Le tutoriel vous permet d'installer Codium, Unity, et de relier un projet Unity avec Codium pour bénéficier de l'auto-complétion dans Codium.
|
||||||
|
|
||||||
|
## Installer Unity Hub
|
||||||
|
|
||||||
|
Suivre les instructions ici: [Unity Hub](https://docs.unity3d.com/hub/manual/InstallHub.html#install-hub-linux)
|
||||||
|
|
||||||
|
## Créer un compte Unity + license
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Une fois le compte Unity créé, il suffit d'importer le fichier `` (license) dans le Unity Hub
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Installer Unity
|
## Installer Unity
|
||||||
|
|
||||||
Utilisez [Appimage](https://docs.unity3d.com/Manual/GettingStartedInstallingHub.html)
|

|
||||||
|
|
||||||
## Installer Codium
|
## Installer VSCodium
|
||||||
|
|
||||||
Installer à partir des dépots officiels avec [apt](https://debian-facile.org/utilisateurs:sushy:tutos:visual-studio-codium)
|
Suivre les instructions ici: [VSCodium](https://vscodium.com/#install-on-debian-ubuntu-deb-package)
|
||||||
|
|
||||||
## Installer .Net
|
## Configurer Unity pour utiliser VSCodium
|
||||||
|
|
||||||
``` { .bash .copy }
|

|
||||||
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
|
|
||||||
sudo dpkg -i packages-microsoft-prod.deb
|
|
||||||
sudo apt-get update; \
|
|
||||||
sudo apt-get install -y apt-transport-https && \
|
|
||||||
sudo apt-get update && \
|
|
||||||
sudo apt-get install -y dotnet-sdk-3.1
|
|
||||||
```
|
|
||||||
|
|
||||||
## Installer Mono
|
|
||||||
|
|
||||||
``` { .bash .copy }
|
|
||||||
sudo apt install apt-transport-https dirmngr gnupg ca-certificates
|
|
||||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
|
|
||||||
echo "deb https://download.mono-project.com/repo/debian stable-buster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install mono-complete
|
|
||||||
```
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
|
|
||||||
Made with [Carlo Hamalainen's blog](https://carlo-hamalainen.net/2020/07/11/unity3d-setup-debian10-intellisense/)
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user