Sanjay 4 years ago
commit 551fae4606

@ -0,0 +1,13 @@
name: Lock closed issue
on:
issues:
types: [closed]
jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: OSDKDev/lock-issues@v1.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

@ -2,7 +2,7 @@
This lesson covers the basics of programming languages. The topics covered here apply to most modern programming languages today. In the 'Tools of the Trade' section, you'll learn about useful software that helps you as a developer.
![Intro Programming](webdev101-programming.png)
![Intro Programming](/sketchnotes/webdev101-programming.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz

@ -2,7 +2,7 @@
## Instructions
There are many tools that a web developer may need that are on the [MDN documentation for client-side tooling](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Select 3 tools not covered in the lesson, explain why a web developer would use it, and search for a tool that falls under this category and share its documentation. Do not use the same tool example on MDN docs.
There are many tools that a web developer may need that are on the [MDN documentation for client-side tooling](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Select 3 tools not covered in the lesson, explain why a web developer would use it, and search for a tool that falls under this category and share its documentation. Do not use the same tool example on MDN docs.
## Rubric

@ -1,6 +1,9 @@
# Introducción a lenguajes de programación y herramientas del oficio
Esta lección cubre los conceptos básicos de los lenguajes de programación. Los temas que se tratan aquí se aplican a la mayoría de los lenguajes de programación modernos en la actualidad. En la sección 'Herramientas del oficio', aprenderá sobre software útil que lo ayuda como desarrollador.
Esta lección cubre los conceptos básicos de los lenguajes de programación. Los temas que aprenderemos aquí se aplican a la mayoría de los lenguajes de programación modernos en la actualidad. En la sección 'Herramientas del oficio', aprenderás sobre software y herramientas que te ayudarán como desarrollador.
![Intro Programming](/sketchnotes/webdev101-programming.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## [Pre-lecture quiz](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/1)
### Introducción
@ -10,21 +13,21 @@ En esta lección, cubriremos:
- ¿Qué es la programación?
- Tipos de lenguajes de programación
- Elementos básicos de un programa
- Software y herramientas útiles para el desarrollador profesional.
- Software y herramientas para desarrolladores profesionales
## ¿Qué es la programación?
La programación (también conocida como codificación) es el proceso de escribir instrucciones en un dispositivo, como una computadora o un dispositivo móvil. Escribimos estas instrucciones con un lenguaje de programación, que luego es interpretado por el dispositivo. Estos conjuntos de instrucciones pueden tener varios nombres, pero *programa*, *programa de computadora*, *aplicación (app)* y *ejecutable* son algunos nombres populares.
La programación (también conocida como codificación) es el proceso de escribir instrucciones en un dispositivo, como una computadora o un celular. Escribimos estas instrucciones con un lenguaje de programación, que luego es interpretado por el dispositivo. Estos conjuntos de instrucciones pueden tener varios nombres, pero *programa*, *programa de computadora*, *aplicación (app)* y *ejecutable* son algunos nombres populares.
Un *programa* puede ser cualquier cosa que esté escrita con código; los sitios web, los juegos y las aplicaciones de teléfono son programas. Si bien es posible crear un programa sin escribir código, la lógica subyacente se interpreta al dispositivo y esa lógica probablemente se escribió con código. Un programa que está *ejecutándose* o *ejecutando código* está ejecutando instrucciones. El dispositivo con el que estás leyendo esta lección está ejecutando un programa para imprimirlo en tu pantalla.
Un *programa* puede ser cualquier cosa que esté escrita con código; los sitios web, los video juegos y las aplicaciones de teléfono son programas. Si bien es posible crear un programa sin escribir código, la lógica subyacente se interpreta al dispositivo y esa lógica probablemente se escribió con código. Un programa que está *ejecutándose* o *ejecutando código* está ejecutando instrucciones. El dispositivo con el que estás leyendo esta lección está ejecutando un programa para imprimirlo en tu pantalla.
✅ Investigua un poco: ¿quién se considera el primer programador de computadoras del mundo?
✅ Investigua un poco: ¿quién se considera el primer programador(a) de computadoras del mundo?
## Lenguajes de programación
Los lenguajes de programación tienen un propósito principal: que los desarrolladores creen instrucciones para enviarlas a un dispositivo. Los dispositivos solo pueden entender binarios (1 y 0), y para *la mayoría* de los desarrolladores esa no es una forma muy eficiente de comunicarse. Los lenguajes de programación son un vehículo para la comunicación entre humanos y computadoras.
Los lenguajes de programación tienen un propósito principal: que los desarrolladores crear instrucciones para enviarlas a un dispositivo. Los dispositivos solo pueden entender binarios (1 y 0), y para *la mayoría* de los desarrolladores, esa no es una forma muy eficiente de comunicarse. Los lenguajes de programación son un vehículo para la comunicación entre humanos y computadoras.
Los lenguajes de programación vienen en diferentes formatos y pueden tener diferentes propósitos. Por ejemplo, JavaScript se usa principalmente para aplicaciones web, mientras que Bash se usa principalmente para sistemas operativos.
Los lenguajes de programación vienen en diferentes formatos y tienen diferentes propósitos. Por ejemplo, JavaScript se usa principalmente para aplicaciones web, mientras que Bash se usa principalmente para sistemas operativos.
*Los idiomas de bajo nivel* normalmente requieren menos pasos que los *idiomas de alto nivel* para que un dispositivo interprete las instrucciones. Sin embargo, lo que hace que los lenguajes de alto nivel sean populares es su legibilidad y soporte. JavaScript se considera un lenguaje de alto nivel.
@ -85,20 +88,20 @@ Existe la posibilidad de que un dispositivo no ejecute algunas declaraciones. Es
[![Tools of the Trade](https://img.youtube.com/vi/69WJeXGBdxg/0.jpg)](https://youtube.com/watch?v=69WJeXGBdxg "Tools of the Trade")
En esta sección, aprenderá sobre algún software que puede resultarle muy útil al comenzar su viaje de desarrollo profesional.
En esta sección, aprenderás sobre software que puede ayudarte comenzar tu viaje de desarrollo profesional.
Un **entorno de desarrollo** es un conjunto único de herramientas y características que un desarrollador utilizará a menudo al escribir software. Algunas de estas herramientas se han personalizado para las necesidades específicas de un desarrollador y pueden cambiar con el tiempo si un desarrollador cambia las prioridades en el trabajo o proyectos personales, o cuando usa un lenguaje de programación diferente. Los entornos de desarrollo son tan únicos como los desarrolladores que los utilizan.
### Editores
Una de las herramientas más importantes para el desarrollo de software es el editor. Los editores son el lugar donde escribe su código y, a veces, donde ejecutará su código.
Una de las herramientas más importantes para el desarrollo de software es el editor. Los editores son el lugar donde escribes su código y, a veces, donde ejecutarás tu código.
Los desarrolladores confían en los editores por algunas razones adicionales:
- *Depuración* Descubrimiento de errores y errores al recorrer el código, línea por línea. Algunos editores tienen capacidades de depuración o se pueden personalizar y agregar para lenguajes de programación específicos.
- *Resaltado de sintaxis* Agrega colores y formato de texto al código, lo hace más fácil de leer. La mayoría de los editores permiten el resaltado de sintaxis personalizado.
- *Extensiones e integraciones del navegador* Adiciones especializadas para desarrolladores, por desarrolladores, para acceder a herramientas adicionales que no están integradas en el editor base. Por ejemplo, muchos desarrolladores también necesitan una forma de documentar su código y explicar cómo funciona, e instalarán una extensión de revisión ortográfica para verificar si hay errores tipográficos. La mayoría de estas adiciones están diseñadas para su uso dentro de un editor específico, y la mayoría de los editores vienen con una forma de buscar extensiones disponibles.
- *Personalización* La mayoría de los editores son extremadamente personalizables, y cada desarrollador tendrá su propio entorno de desarrollo único que se adapta a sus necesidades. Muchos también permiten a los desarrolladores crear su propia extensión.
- *Depuración* - Descubrimiento de errores y errores al recorrer el código, línea por línea. Algunos editores tienen capacidades de depuración o se pueden personalizar y agregar para lenguajes de programación específicos.
- *Resaltado de sintaxis* - Agrega colores y formato de texto al código, lo hace más fácil de leer. La mayoría de los editores permiten el resaltado de sintaxis personalizado.
- *Extensiones e integraciones del navegador* - Adiciones especializadas para desarrolladores, por desarrolladores, para acceder a herramientas adicionales que no están integradas en el editor base. Por ejemplo, muchos desarrolladores también necesitan una forma de documentar su código y explicar cómo funciona, e instalarán una extensión de revisión ortográfica para verificar si hay errores. La mayoría de estas adiciones están diseñadas para usarse dentro de un editor específico, y la mayoría de los editores vienen con una forma de buscar extensiones disponibles.
- *Personalización* - La mayoría de los editores son extremadamente personalizables, y cada desarrollador tendrá su propio entorno de desarrollo único que se adapta a sus necesidades. Muchos también permiten a los desarrolladores crear su propia extensión.
#### Editores populares y extensiones de desarrollo web
@ -114,9 +117,9 @@ Los desarrolladores confían en los editores por algunas razones adicionales:
### Navegadores
Otra herramienta fundamental es el navegador. Los desarrolladores web confían en el navegador para observar cómo se ejecuta su código en la web, también se usa para ver elementos visuales de una página web que están escritos en el editor, como HTML.
Otra herramienta fundamental es el navegador. Los desarrolladores de web confían en el navegador para observar cómo se ejecuta su código en la web. También se usa para ver elementos visuales de una página web que están escritos en el editor, como HTML.
Muchos navegadores vienen con *herramientas para desarrolladores* (DevTools) que contienen un conjunto de características e información útiles para ayudar a los desarrolladores a recopilar y capturar información importante sobre su aplicación. Por ejemplo: si una página web tiene errores, a veces es útil saber cuándo ocurrieron. DevTools en un navegador se puede configurar para capturar esta información.
Muchos navegadores vienen con *herramientas para desarrolladores* (DevTools) que contienen un conjunto de características e información útiles para ayudar a los desarrolladores a recopilar y capturar información importante sobre su aplicación. Por ejemplo: si una página web tiene errores, a veces es útil saber cuándo ocurrieron. Se puede configurar DevTools en un navegador para capturar esta información.
#### Navegadores y herramientas de desarrollo populares
@ -124,15 +127,15 @@ Muchos navegadores vienen con *herramientas para desarrolladores* (DevTools) que
- [Chrome](https://developers.google.com/web/tools/chrome-devtools/)
- [Firefox](https://developer.mozilla.org/docs/Tools)
### Herramientas de línea de comandos
### Herramientas de línea de comandos (CLI)
Algunos desarrolladores prefieren una vista menos gráfica para sus tareas diarias y confían en la línea de comandos para lograrlo. El desarrollo de código requiere una gran cantidad de escritura, y algunos desarrolladores prefieren no interrumpir su flujo en el teclado y usarán atajos de teclado para cambiar entre ventanas de escritorio, trabajar en diferentes archivos y usar herramientas. La mayoría de las tareas se pueden completar con un mouse, pero una de las ventajas de utilizar la línea de comandos es que se pueden hacer muchas cosas con las herramientas de la línea de comandos sin necesidad de cambiar entre el mouse y el teclado. Otro beneficio de la línea de comandos es que son configurables y puede guardar su configuración personalizada, cambiarla más tarde y también importarla a nuevas máquinas de desarrollo. Debido a que los entornos de desarrollo son tan exclusivos para cada desarrollador, algunos evitarán usar la línea de comandos, algunos dependerán de ella por completo y algunos prefieren una combinación de ambos.
Algunos desarrolladores prefieren una vista menos gráfica para sus tareas diarias y confían en la línea de comandos **(CLI)** para lograrlo. El desarrollo de código requiere una gran cantidad de escritura, y algunos desarrolladores prefieren no interrumpir su flujo en el teclado y usarán atajos (shortcut) de teclado para cambiar entre ventanas de escritorio, trabajar en diferentes archivos y usar herramientas. La mayoría de las tareas se pueden completar con un mouse, pero una de las ventajas de utilizar la línea de comandos es que se pueden hacer muchas cosas con las herramientas de la línea de comandos, sin necesidad de cambiar entre el mouse y el teclado. Otro beneficio de la línea de comandos es que son configurables y puedes guardar tu configuración personalizada, cambiarla más tarde y también importarla a nuevas máquinas de desarrollo. Debido a que los entornos de desarrollo son tan exclusivos para cada desarrollador, algunos evitarán usar la línea de comandos, algunos dependerán de ella por completo y algunos prefieren una combinación de ambos.
### Opciones de línea de comandos populares
### Opciones de línea de comandos (CLI) populares
Las opciones para la línea de comando varian según el sistema operativo que utilice.
Las opciones para la línea de comando varian según el sistema operativo que utilices.
*💻 = viene preinstalado en el sistema operativo.*
💻 = *viene preinstalado en el sistema operativo.*
#### Windows
@ -153,7 +156,7 @@ Las opciones para la línea de comando variarán según el sistema operativo que
- [KDE Konsole](https://docs.kde.org/trunk5/en/applications/konsole/index.html)
- [Powershell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7?WT.mc_id=academic-13441-cxa)
#### Popular Command Line Tools
#### Línea de comandos (CLI) Populares
- [Git](https://git-scm.com/) (💻 en la mayoría de los sistemas operativos)
- [NPM](https://www.npmjs.com/)
@ -161,9 +164,9 @@ Las opciones para la línea de comando variarán según el sistema operativo que
### Documentación
Cuando un desarrollador quiere aprender algo nuevo, lo más probable es que recurra a la documentación para aprender a usarla. Los desarrolladores a menudo confían en la documentación para guiarlos a través de cómo usar las herramientas y los lenguajes correctamente, y también para obtener un conocimiento más profundo de cómo funciona.
Cuando un desarrollador quiere aprender algo nuevo, lo más probable es que recurras a la documentación para aprender a usarla. Los desarrolladores a menudo confían en la documentación para guiarlos a través de cómo usar las herramientas y los lenguajes correctamente, y también para obtener un conocimiento más profundo de cómo funciona.
#### Documentación popular sobre desarrollo web
#### Documentación popular sobre desarrollo de web
- [Mozilla Developer Network](https://developer.mozilla.org/docs/Web)
- [Frontend Masters](https://frontendmasters.com/learn/)
@ -178,6 +181,6 @@ Compara algunos lenguajes de programación. ¿Cuáles son algunos de los rasgos
## Revisión y autoestudio
Estudia un poco sobre los diferentes lenguajes disponibles para el programador. Intente escribir una línea en un idioma y luego vuelva a hacerlo en otros dos. ¿Qué aprendes?
Estudia un poco sobre los diferentes lenguajes disponibles para el programador. Intenta escribir una línea en un idioma y luego vuelve a hacerlo en otros dos. ¿Qué aprendiste?
**Asignación**: [Asignación](../assignment.md)
**Tarea**: [Tarea](../assignment.md)

@ -0,0 +1,191 @@
# Introduction aux langages de programmation et aux outils du métier
Cette leçon couvre les bases des langages de programmation. Les sujets abordés ici s'appliquent à la plupart des langages de programmation modernes d'aujourd'hui. Dans la section «Outils du métier», vous découvrirez des logiciels utiles qui vous aideront en tant que développeur.
![Intro Programming](/sketchnotes/webdev101-programming.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz
[Pre-lecture quiz](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/1)
## introduction
Dans cette leçon, nous aborderons:
- Qu'est-ce que la programmation?
- Types de langages de programmation
- Éléments de base d'un programme
- Logiciel et outillage utiles pour le développeur professionnel
## Qu'est-ce que la programmation?
Pla programmation (également appelée codage) est le processus d'écriture d'instructions sur un appareil, tel qu'un ordinateur ou un appareil mobile. Nous écrivons ces instructions avec un langage de programmation, qui est ensuite interprété par l'appareil. Ces ensembles d'instructions peuvent être désignés sous différents noms, mais *programme*, *programme informatique*, *application (application)* et *exécutable* sont quelques noms courants.
Un *programme* peut être tout ce qui est écrit avec du code; les sites Web, les jeux et les applications téléphoniques sont des programmes. Bien qu'il soit possible de créer un programme sans écrire de code, la logique sous-jacente est interprétée sur le périphérique et cette logique a probablement été écrite avec du code. Un programme qui *exécute* ou *exécute du code* exécute des instructions. L'appareil avec lequel vous lisez actuellement cette leçon exécute un programme pour l'imprimer sur votre écran.
✅ Faites une petite recherche: qui est considéré comme le premier programmeur informatique au monde?
## Langages de programmation
Les langages de programmation ont un objectif principal: permettre aux développeurs de créer des instructions à envoyer à un appareil. Les appareils ne peuvent comprendre que le binaire (1 et 0), et pour *la plupart* les développeurs, ce n'est pas un moyen très efficace de communiquer. Les langages de programmation sont un vecteur de communication entre les humains et les ordinateurs.
Les langages de programmation se présentent sous différents formats et peuvent servir à des fins différentes. Par exemple, JavaScript est principalement utilisé pour les applications Web, tandis que Bash est principalement utilisé pour les systèmes d'exploitation.
*Les langues de bas niveau* nécessitent généralement moins d'étapes que les *langues de haut niveau* pour qu'un appareil interprète les instructions. Cependant, ce qui rend les langages de haut niveau populaires, c'est leur lisibilité et leur support. JavaScript est considéré comme un langage de haut niveau.
Le code suivant illustre la différence entre un langage de haut niveau avec JavaScript et un langage de bas niveau avec le code d'assembly ARM.
```javascript
let number = 10
let n1 = 0, n2 = 1, nextTerm;
for (let i = 1; i <= number; i++) {
console.log(n1);
nextTerm = n1 + n2;
n1 = n2;
n2 = nextTerm;
}
```
```c
area ascen,code,readonly
entry
code32
adr r0,thumb+1
bx r0
code16
thumb
mov r0,#00
sub r0,r0,#01
mov r1,#01
mov r4,#10
ldr r2,=0x40000000
back add r0,r1
str r0,[r2]
add r2,#04
mov r3,r0
mov r0,r1
mov r1,r3
sub r4,#01
cmp r4,#00
bne back
end
```
Croyez-le ou non, *they're both doing the same thing*: impression d'une séquence de Fibonacci jusqu'à 10.
✅ Une séquence de Fibonacci est [defined](https://en.wikipedia.org/wiki/Fibonacci_number) comme un ensemble de nombres tels que chaque nombre est la somme des deux précédents, à partir de 0 et 1.
## Éléments d'un programme
Une seule instruction dans un programme est appelée une *instruction* et aura généralement un caractère ou un interligne qui marque où l'instruction se termine, ou *se termine*. La façon dont un programme se termine varie avec chaque langue.
La plupart des programmes reposent sur l'utilisation des données d'un utilisateur ou d'ailleurs, où les déclarations peuvent s'appuyer sur des données pour exécuter des instructions. Les données peuvent modifier le comportement d'un programme, de sorte que les langages de programmation proposent un moyen de stocker temporairement des données pouvant être utilisées ultérieurement. Ces données sont appelées *variables*. Les variables sont des instructions qui demandent à un appareil d'enregistrer des données dans sa mémoire. Les variables des programmes sont similaires à celles de l'algèbre, où elles ont un nom unique et leur valeur peut changer avec le temps.
Il est possible que certaines instructions ne soient pas exécutées par un périphérique. C'est généralement par conception lors de l'écriture par le développeur ou par accident lorsqu'une erreur inattendue se produit. Ce type de contrôle d'une application la rend plus robuste et maintenable. Généralement, ces changements de contrôle se produisent lorsque certaines décisions sont respectées. Une instruction courante dans les langages de programmation modernes pour contrôler la manière dont un programme est exécuté est l'instruction `if..else`.
✅ Vous en apprendrez plus sur ce type d'énoncé dans les leçons suivantes
## Outils du métier
[![Tools of the Trade](https://img.youtube.com/vi/69WJeXGBdxg/0.jpg)](https://youtube.com/watch?v=69WJeXGBdxg "Tools of the Trade")
Dans cette section, vous découvrirez certains logiciels que vous pourriez trouver très utiles au début de votre parcours de développement professionnel.
Un **environnement de développement** est un ensemble unique d'outils et de fonctionnalités qu'un développeur utilisera souvent lors de l'écriture d'un logiciel. Certains de ces outils ont été personnalisés pour les besoins spécifiques d'un développeur et peuvent changer au fil du temps si un développeur change de priorités dans ses projets professionnels ou personnels, ou lorsqu'il utilise un langage de programmation différent. Les environnements de développement sont aussi uniques que les développeurs qui les utilisent.
### éditeurs
L'éditeur est l'un des outils les plus cruciaux pour le développement logiciel. Les éditeurs sont l'endroit où vous écrivez votre code et parfois où vous exécuterez votre code.
Les développeurs comptent sur les éditeurs pour quelques raisons supplémentaires:
- *Débogage* Découverte des bogues et des erreurs en parcourant le code, ligne par ligne. Certains éditeurs ont des capacités de débogage ou peuvent être personnalisés et ajoutés pour des langages de programmation spécifiques.
- *Mise en évidence de la syntaxe* Ajoute des couleurs et la mise en forme du texte au code, le rend plus facile à lire. La plupart des éditeurs permettent une coloration syntaxique personnalisée.
- *Extensions et intégrations* Ajouts spécialisés pour les développeurs, par les développeurs, pour accéder à des outils supplémentaires qui ne sont pas intégrés à l'éditeur de base. Par exemple, de nombreux développeurs ont également besoin d'un moyen de documenter leur code et d'expliquer comment il fonctionne et installeront une extension de vérification orthographique pour vérifier les fautes de frappe. La plupart de ces ajouts sont destinés à être utilisés dans un éditeur spécifique, et la plupart des éditeurs proposent un moyen de rechercher les extensions disponibles.
- *Personnalisation* La plupart des éditeurs sont extrêmement personnalisables, et chaque développeur aura son propre environnement de développement unique qui répond à ses besoins. Beaucoup permettent également aux développeurs de créer leur propre extension.
#### Éditeurs et extensions de développement Web populaires
- [Visual Studio Code](https://code.visualstudio.com/)
- [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
- [Live Share](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare-pack)
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [Atom](https://atom.io/)
- [spell-check](https://atom.io/packages/spell-check)
- [teletype](https://atom.io/packages/teletype)
- [atom-beautify](https://atom.io/packages/atom-beautify)
### Navigateurs
Un autre outil crucial est le navigateur. Les développeurs Web comptent sur le navigateur pour observer comment leur code s'exécute sur le Web, il est également utilisé pour afficher les éléments visuels d'une page Web qui sont écrits dans l'éditeur, comme le HTML.
De nombreux navigateurs sont livrés avec des *outils de développement* (DevTools) qui contiennent un ensemble de fonctionnalités et d'informations utiles pour aider les développeurs à collecter et capturer des informations importantes sur leur application. Par exemple: si une page Web contient des erreurs, il est parfois utile de savoir quand elles se sont produites. DevTools dans un navigateur peut être configuré pour capturer ces informations.
#### Navigateurs et outils de développement populaires
- [Edge](https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium?WT.mc_id=academic-13441-cxa)
- [Chrome](https://developers.google.com/web/tools/chrome-devtools/)
- [Firefox](https://developer.mozilla.org/docs/Tools)
### ligne de commande
Certains développeurs préfèrent une vue moins graphique pour leurs tâches quotidiennes et comptent sur la ligne de commande pour y parvenir. Le développement de code nécessite une quantité importante de saisie, et certains développeurs préfèrent ne pas perturber leur flux sur le clavier et utiliseront des raccourcis clavier pour basculer entre les fenêtres du bureau, travailler sur différents fichiers et utiliser des outils. La plupart des tâches peuvent être effectuées avec une souris, mais un avantage de l'utilisation de la ligne de commande est que beaucoup peut être fait avec des outils de ligne de commande sans avoir besoin de permuter entre la souris et le clavier. Un autre avantage de la ligne de commande est qu'elle est configurable et que vous pouvez enregistrer votre configuration personnalisée, la modifier ultérieurement et également l'importer sur de nouvelles machines de développement. Parce que les environnements de développement sont si uniques à chaque développeur, certains éviteront d'utiliser la ligne de commande, certains s'y fieront entièrement, et certains préfèrent un mélange des deux.
### Options de ligne de commande populaires
Les options de la ligne de commande varient en fonction du système d'exploitation que vous utilisez.
*💻 = est préinstallé sur le système d'exploitation.*
#### Windows
- [Powershell](https://docs.microsoft.com/powershell/scripting/overview?view=powershell-7?WT.mc_id=academic-13441-cxa) 💻
- [Command Line](https://docs.microsoft.com/windows-server/administration/windows-commands/windows-commands?WT.mc_id=academic-13441-cxa) (also known as CMD) 💻
- [Windows Terminal](https://docs.microsoft.com/windows/terminal/?WT.mc_id=academic-13441-cxa)
- [mintty](https://mintty.github.io/)
#### MacOS
- [Terminal](https://support.apple.com/guide/terminal/open-or-quit-terminal-apd5265185d-f365-44cb-8b09-71a064a42125/mac) 💻
- [iTerm](https://iterm2.com/)
- [Powershell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell-core-on-macos?view=powershell-7?WT.mc_id=academic-13441-cxa)
#### Linux
- [Bash](https://www.gnu.org/software/bash/manual/html_node/index.html) 💻
- [KDE Konsole](https://docs.kde.org/trunk5/en/applications/konsole/index.html)
- [Powershell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7?WT.mc_id=academic-13441-cxa)
#### Popular Command Line Tools
- [Git](https://git-scm.com/) (💻 on most operating sytems)
- [NPM](https://www.npmjs.com/)
- [Yarn](https://classic.yarnpkg.com/en/docs/cli/)
### Documentation
Lorsqu'un développeur souhaite apprendre quelque chose de nouveau, il se tournera très probablement vers la documentation pour apprendre à l'utiliser. Les développeurs s'appuient souvent sur la documentation pour les guider dans la manière d'utiliser correctement les outils et les langages, et également pour acquérir une connaissance plus approfondie de son fonctionnement.
#### Documentation populaire sur le développement Web
- [Mozilla Developer Network](https://developer.mozilla.org/docs/Web)
- [Frontend Masters](https://frontendmasters.com/learn/)
✅ Faites des recherches: maintenant que vous connaissez les bases de l'environnement d'un développeur Web, comparez-le et comparez-le à l'environnement d'un concepteur Web.
---
## 🚀 Défi
Comparez quelques langages de programmation. Quelles sont certaines des caractéristiques uniques de JavaScript par rapport à Java? Et COBOL vs Go?
## Quiz post-conférence
[Quiz post-conférence](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/2)
## Révision et auto-étude
Étudiez un peu les différentes langues disponibles pour le programmeur. Essayez d'écrire une ligne dans une langue, puis refaites-la dans deux autres. Qu'apprenez-vous?
## Affectation
[Lire la documentation](assignment.fr.md)

@ -2,7 +2,7 @@
Αυτό το μάθημα καλύπτει τα βασικά των γλωσσών προγραμματισμού. Τα θέματα που καλύπτονται εδώ ισχύουν για τις περισσότερες σύγχρονες γλώσσες προγραμματισμού σήμερα. Στην ενότητα 'Εργαλεία του Εμπορίου', θα μάθετε για χρήσιμο λογισμικό που σας βοηθά ως προγραμματιστές.
![Intro Programming](../webdev101-programming.png)
![Intro Programming](/sketchnotes/webdev101-programming.png)
> Σκίτσο από [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz

@ -2,7 +2,7 @@
Pelajaran ini mencakup dasar-dasar bahasa pemrograman. Topik yang dibahas di sini berlaku untuk sebagian besar bahasa pemrograman modern saat ini. Di bagian 'Alat Keterampilan', Anda akan belajar tentang perangkat lunak yang berguna yang membantu Anda sebagai pengembang.
![Pemrograman Intro](../webdev101-programming.png)
![Pemrograman Intro](/sketchnotes/webdev101-programming.png)
> Catatan sketsa oleh [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuis Pra-Kuliah

@ -2,7 +2,7 @@
Questa lezione tratta delle basi dei linguaggi di programmazione. Gli argomenti trattati qui si applicano alla maggior parte dei moderni linguaggi di programmazione di oggi. Nella sezione 'Strumenti Necessari' conoscerete utili software che vi aiuteranno come programmatore.
![Introduzione alla Programmazione](../webdev101-programming.png)
![Introduzione alla Programmazione](/sketchnotes/webdev101-programming.png)
> Sketchnote di [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz Pre-Lezione

@ -4,7 +4,7 @@
ここで取り上げた特徴は、最新のプログラミング言語のほとんどに当てはまります。
次にツールセクションでは、開発者にとって有用なソフトウェアを紹介します。
![Intro Programming](../webdev101-programming.png)
![Intro Programming](/sketchnotes/webdev101-programming.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## 事前クイズ

@ -2,7 +2,7 @@
이 강의에서는 프로그래밍 언어의 기초를 다룹니다. 여기에서 다루는 주제는 오늘 날 많은 최신 프로그래밍 언어에 적용됩니다. 'Tools of the Trade' 세션에서는 개발자에게 도움이 되는 유용한 소프트웨어에 대해 알아보겠습니다.
![Intro Programming](../webdev101-programming.png)
![Intro Programming](/sketchnotes/webdev101-programming.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## 강의 전 퀴즈

@ -2,7 +2,7 @@
Pelajaran ini merangkumi asas bahasa pengaturcaraan. Topik yang anda akan belajar di sini dapat mengaplikasikan untuk kebanyakan bahasa pengaturcaraan moden hari ini. Pada bahagian 'Alat Perdagangan', anda akan belajar bagaimana mengenai perisian berguna yang membantu anda sebagai pembangun.
![Intro Programming](../webdev101-programming.png)
![Intro Programming](/sketchnotes/webdev101-programming.png)
> Sketchnote karya [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuiz Pra-Kuliah

@ -1,8 +1,8 @@
# Introductie van Programmeertalen en Bijbehorend Vakgereedschap
Deze les beschrijft de basis over programmeertalen. De onderwerpen zijn van toepassing op de meeste hedendaagse programeertalen. In het 'Vakgereedschap' onderdeel leer je over nuttige toepassingen die je helpen als web ontwikkelaar.
Deze les beschrijft de basis over programmeertalen. De onderwerpen zijn van toepassing op de meeste hedendaagse programeertalen. In het 'Vakgereedschap' onderdeel leert u over nuttige toepassingen die u helpen als web ontwikkelaar.
![Introductie Programmeren](../webdev101-programming.png)
![Introductie Programmeren](/sketchnotes/webdev101-programming.png)
> Sketchnote door [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz
@ -22,7 +22,7 @@ In deze les hebben we het over:
Programmeren (ook wel coderen genoemd) is het process van het schrijven van instructies voor een apparaat, zoals een computer of een mobieltje. We schrijven deze instructies met een programmeertaal, welke wordt geinterpreteerd door het apparaat. Deze sets van instructies staan bekend onder verschillende namen zoals; *programma*, *computer programma*, *applicatie (app)*, *script* en *executable*.
Een *programma* kan van alles zijn wat met code is geschreven; websites, spellen, en mobiele apps zijn programmas. Hoewel het mogelijk is om een programma te maken zonder code te schrijven, is de onderliggende logica, dat wordt geinterpreteerd door het apparaat, hoogstwaarschijnlijk wel geschreven met code. Een programma dat *draait* of *code uitvoert* voert instructies uit. Het apparaat wat je nu gebruikt om deze les te volgen draait een programma om deze tekst op het scherm te tonen.
Een *programma* kan van alles zijn wat met code is geschreven; websites, spellen, en mobiele apps zijn programmas. Hoewel het mogelijk is om een programma te maken zonder code te schrijven, is de onderliggende logica, dat wordt geinterpreteerd door het apparaat, hoogstwaarschijnlijk wel geschreven met code. Een programma dat *draait* of *code uitvoert* voert instructies uit. Het apparaat wat u nu gebruikt om deze les te volgen draait een programma om deze tekst op het scherm te tonen.
✅ Doe wat onderzoek: wie wordt gezien als werelds eerste computer programmeur?
@ -85,24 +85,24 @@ De meeste programma's zijn afhankelijk van gegevens, die ofwel door een gebruike
Niet alle statements in een programma worden altijd uitgevoerd. Dit is meestal zo bedacht door de ontwikkelaar of het treed onbedoeld op bij onverwachte fouten. Het is een vorm van controle in een applicatie, dat het robuuster en onderhoudbaarder maakt. De keuze in welke statements worden uitgevoerd hangt vaak af van de data en of dit voldoet aan bepaalde condities. Een veelvoorkomend statement in een moderne programmeertaal om de controle van een programma te beïnvloeden is het `if..else` statement.
Je leert meer over het `if..else` statement in de volgende lessen.
U leert meer over het `if..else` statement in de volgende lessen.
## Vakgereedschap
[![Vakgereedschap](https://img.youtube.com/vi/69WJeXGBdxg/0.jpg)](https://youtube.com/watch?v=69WJeXGBdxg "Vakgereedschap")
In dit onderdeel leer je welke applicaties je wellicht handig vindt om mee te werken als je je professionele web ontwikkelaar carrière start.
In dit onderdeel leert u welke applicaties u wellicht handig vindt om mee te werken als u uw professionele web ontwikkelaar carrière start.
Een **ontwikkelomgeving** is een unieke set van applicaties wat een ontwikkelaar regelmatig gebruikt om software te schrijven. Sommige van deze applicaties zijn aangepast voor de specifieke eisen die de ontwikkelaar heeft en kunnen veranderen over de tijd. Dit kan te maken hebben met het type werk wat de ontwikkelaar uitvoert, bijvoorbeeld persoonlijke projecten versus projecten voor werk, of als er een andere programmeertaal moet worden gebruikt. Ontwikkelomgevingen zijn zo uniek als de ontwikkelaars die ze gebruiken.
### Editors
Een van de meest cruciale applicaties voor software ontwikkeling is de code editor. In een editor schrijf je je code en soms run je daar ook je code.
Een van de meest cruciale applicaties voor software ontwikkeling is de code editor. In een editor schrijft u uw code en soms runt u daar ook uw code.
Ontwikkelaars gebruiken editors ook om de volgende redenen:
- *Debugging* Het regel voor regel runnen van je code om bugs te ontdekken. Sommige editors hebben debugging mogelijkheden, of kunnen aangepast worden voor specifieke programmeertalen.
- *Syntax markering* Voegt kleuren en tekst opmaak toe aan code om het leesbaarder te maken. De meeste editors hebben de mogelijkheid om dit aan te passen naar je eigen smaak.
- *Debugging* Het regel voor regel runnen van uw code om bugs te ontdekken. Sommige editors hebben debugging mogelijkheden, of kunnen aangepast worden voor specifieke programmeertalen.
- *Syntax markering* Voegt kleuren en tekst opmaak toe aan code om het leesbaarder te maken. De meeste editors hebben de mogelijkheid om dit aan te passen naar uw eigen smaak.
- *Extensies en Integraties* Uitbreidingen van de editor, speciaal voor ontwikkelaars en gemaakt door ontwikkelaars, om extra functionaliteiten toe te voegen die standaard niet in de editor inzitten. Bijvoorbeeld een spellingscontrole extensie wat documentatie kan controleren op spelfouten. Vaak zijn extensies ontwikkeld voor een specifieke code editor. De meeste editors bieden een zoekfunctie om relevante extensies te vinden.
- *Persoonlijke instellingen* De meeste editors hebben instellingen die volledig aan te passen zijn naar de wens van de ontwikkelaar. Elke ontwikkelaar zal daarom een unieke ontwikkelomgeving hebben wat voldoet aan hun specifieke wensen.
@ -131,11 +131,11 @@ Veel browsers hebben ingebouwd *ontwikkel gereedschap* (DevTools) waarmee ontwik
### Command Line Applicaties
Sommige ontwikkelaars hebben de voorkeur om minder grafische applicaties te gebruiken voor hun dagelijks werk. Zij gebruiken *command line applicaties* om hun werk te doen. Voor het schrijven van code is veel typewerk nodig, en aangezien sommige ontwikkelaars niet teveel afgeleid willen worden in hun keyboardgebruik maken zij daarom gebruik van keyboard shortcuts om bijvoorbeeld met verschillende bestanden te werken en tussen applicaties te wisselen. De meeste taken kunnen met een muis worden uitgevoerd, maar één van de voordelen van de command line is dat je heel veel kunt doen zonder te wisselen van keyboard en muis. Een bijkomend voordeel is dat command line applicaties aanpasbaar zijn en je deze naar wens kunt instellen. De instellingen kunnen opgeslagen worden op een andere computer weer herbruikt worden. Omdat elke ontwikkelaar een andere voorkeur heeft qua ontwikkelomgeving, gebruiken sommigen de command line nooit, sommigen doen juist alles ermee, en anderen gebruiken zowel de command line als grafische applicaties.
Sommige ontwikkelaars hebben de voorkeur om minder grafische applicaties te gebruiken voor hun dagelijks werk. Zij gebruiken *command line applicaties* om hun werk te doen. Voor het schrijven van code is veel typewerk nodig, en aangezien sommige ontwikkelaars niet teveel afgeleid willen worden in hun keyboardgebruik maken zij daarom gebruik van keyboard shortcuts om bijvoorbeeld met verschillende bestanden te werken en tussen applicaties te wisselen. De meeste taken kunnen met een muis worden uitgevoerd, maar één van de voordelen van de command line is dat u heel veel kunt doen zonder te wisselen van keyboard en muis. Een bijkomend voordeel is dat command line applicaties aanpasbaar zijn en u deze naar wens kunt instellen. De instellingen kunnen opgeslagen worden op een andere computer weer herbruikt worden. Omdat elke ontwikkelaar een andere voorkeur heeft qua ontwikkelomgeving, gebruiken sommigen de command line nooit, sommigen doen juist alles ermee, en anderen gebruiken zowel de command line als grafische applicaties.
### Populaire Command Lines
Beschikbaarheid van command lines verschilt op basis van het besturingssysteem wat je gebruikt.
Beschikbaarheid van command lines verschilt op basis van het besturingssysteem wat u gebruikt.
*💻 = is geïnstalleerd met het besturingssysteem.*
@ -173,7 +173,7 @@ Wanneer een ontwikkelaar iets nieuws wil leren dan zullen ze waarschijnlijk de b
- [Mozilla Developer Network](https://developer.mozilla.org/docs/Web)
- [Frontend Masters](https://frontendmasters.com/learn/)
✅ Doe wat onderzoek: Nu je de basis weet van de omgeving van een web ontwikkelaar, probeer eens uit te zoeken in hoeverre dit verschilt van een omgeving voor een web designer.
✅ Doe wat onderzoek: Nu u de basis weet van de omgeving van een web ontwikkelaar, probeer eens uit te zoeken in hoeverre dit verschilt van een omgeving voor een web designer.
---
@ -186,7 +186,7 @@ Vergelijk wat programmeertalen. Wat zijn unieke kenmerken van JavaScript vs. Jav
## Review & Zelfstudie
Bestudeer wat voor verschillende programmeertalen er zijn. Zoek in 3 talen een 'Hello World' voorbeeld op. Zo krijg je een goed idee wat er voor nodig is om tekst in de browser te tonen.
Bestudeer wat voor verschillende programmeertalen er zijn. Zoek in 3 talen een 'Hello World' voorbeeld op. Zo krijgt u een goed idee wat er voor nodig is om tekst in de browser te tonen.
## Opdracht

@ -0,0 +1,192 @@
# 编程语言概述与工具介绍
这节课涵盖了编程语言的基础知识,涉及到的内容适用于如今大多数现代编程语言。在“工具介绍”部分,你会了解到一些对开发者很有用的软件。
![Intro Programming](/sketchnotes/webdev101-programming.png)
> 涂鸦笔记作者:[Tomomi Imura](https://twitter.com/girlie_mac)
## 课前小测
[课前小测](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/1?loc=zh_cn)
## 大纲
这节课我们将会介绍:
- 什么是编程?
- 编程语言的种类
- 程序的基本要素
- 对专业开发者很有用的软件和工具
## 什么是编程?
编程programming 俗称写代码coding是向诸如计算机或移动设备之类的设备写入指令的过程。我们使用编程语言来编写这些指令然后交由设备去解释interpret。这些指令的集合有许多叫法常见的有*程序program*、*计算机程序computer program*、*应用程序application / app*和*可执行文件executable*。
*程序*可以是任何由代码编写的东西,比如网站、游戏和手机应用。尽管的确有办法不编写任何代码就创建一个程序,但是设备还是会去解析其底层逻辑,这个逻辑大概率是由代码编写的。所谓*正在运行*或是*执行代码*的程序所做的其实都是执行指令。你现在用来阅读这段文字的设备,也正在运行一个将文字输出到你的屏幕上的程序。
✅ 查一查:谁被认为是世界上第一位计算机程序员?
## 编程语言
编程语言的主要目的是:让开发者可以构建指令并将它们传递给设备。设备只能理解二进制(一堆 0 和 1这对*大多数*开发者来说实在不算是高效的交流方式,而编程语言正是人类与计算机之间沟通的桥梁。
编程语言有着不同的形式,也可能用于不同的目的。比如 JavaScript 主要用于 Web 应用,而 Bash 则主要用于操作系统。
对于设备来说看,解释*低级语言low level languages*的指令一般会比解释*高级语言high level languages*的指令需要更少的步骤。然而高级语言因为其可读性和兼容性会更加常用。JavaScript 就是一种高级语言。
下面的代码展示了高级语言(以 JavaScript 为例)和低级语言(以 ARM 汇编代码为例)的区别:
```javascript
let number = 10
let n1 = 0, n2 = 1, nextTerm;
for (let i = 1; i <= number; i++) {
console.log(n1);
nextTerm = n1 + n2;
n1 = n2;
n2 = nextTerm;
}
```
```c
area ascen,code,readonly
entry
code32
adr r0,thumb+1
bx r0
code16
thumb
mov r0,#00
sub r0,r0,#01
mov r1,#01
mov r4,#10
ldr r2,=0x40000000
back add r0,r1
str r0,[r2]
add r2,#04
mov r3,r0
mov r0,r1
mov r1,r3
sub r4,#01
cmp r4,#00
bne back
end
```
不管你信不信,*它们做的事完全相同*:打印斐波那契数列的前 10 位。
✅ [斐波那契数列](https://zh.wikipedia.org/wiki/%E6%96%90%E6%B3%A2%E9%82%A3%E5%A5%91%E6%95%B0%E5%88%97)是一个由 0 和 1 开头,每个数字都是它之前两个数字之和的数列。
## 程序的基本要素
程序中的单条指令instruction被称作*语句statement*,常用一个字符或是空行来标识指令结束的位置,这种标识可被称为*终止符terminates*。程序的结束方式也因语言而异。
多数程序都需要用到从用户或其他地方获取到的数据data此时语句会根据这些数据来执行指令。数据会改变程序的行为所以编程语言提供了一种临时存储此后会被用到的数据的方法。这些数据被称作*变量variables*。变量也是语句,用来指示设备将数据存到它的内存中。和代数学中的变量类似,程序中的变量也有独立的命名,其值在之后也可能发生改变。
有的语句可能不会被设备执行,这通常是开发者有意为之,否则就是发生了意外的错误。这样的控制可以让应用程序更加稳定和可维护。一般来说这些控制的切换会在满足特定条件的情况下发生。`if..else` 语句就是一个在现代编程语言中常见的用于控制程序的语句。
✅ 你会在此后的课程中学到更多关于此类语句的知识
## 工具介绍
[![Tools of the Trade](https://img.youtube.com/vi/69WJeXGBdxg/0.jpg)](https://youtube.com/watch?v=69WJeXGBdxg "工具介绍")
在这一部分,你将会了解到一些能在你的专业开发之旅中颇有帮助的软件。
**开发环境development environment** 指的是一位开发者自己在编写软件时常会用到的工具和功能的集合。其中一些工具会按照开发者的特定需求被自定义配置,这些工具集也会随着时间发生变化,原因可能是开发者在工作或个人项目中改变了需求的优先级,抑或是切换到了另一种编程语言。开发环境往往因人而异。
### 编辑器
编辑器Editors是软件开发中最关键的工具之一是你用来编写甚至运行你的代码的地方。
开发者选用编辑器还有这些原因:
- *调试Debugging* 通过逐步或逐行地运行代码来发现漏洞和错误。一些编辑器自身带有调试功能,或者可以被自定义添加对特定编程语言的调试功能。
- *语法高亮Syntax highlighting* 为代码添加颜色和文本格式以便阅读。多数编辑器都可以对语法高亮进行自定义。
- *插件和集成Extensions and Integrations* 开发者可以根据自身需要为编辑器添加其原生本不包含的功能。比如,许多开发者需要为代码撰写文档来解释其工作原理,就会安装一个拼写检查插件来检查有没有拼写错误。多数插件都只支持特定的编辑器,多数编辑器也会提供搜索可用插件的方法。
- *自定义Customization* 多数编辑器都是高度可自定义的,每一位开发者都能根据自身需要来自定义自己的开发环境。许多开发者还会编写自己的插件。
#### 主流编辑器和 Web 开发插件
- [Visual Studio Code](https://code.visualstudio.com/)
- [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
- [Live Share](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare-pack)
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [Atom](https://atom.io/)
- [spell-check](https://atom.io/packages/spell-check)
- [teletype](https://atom.io/packages/teletype)
- [atom-beautify](https://atom.io/packages/atom-beautify)
### 浏览器
另一个关键工具是浏览器。Web 开发者需要用浏览器来观察它们的代码如何在网页上运行,还可以看到编辑器中编写的元素(如 HTML 元素)如何展现在网页上。
许多浏览器都提供了*开发者工具*DevTools包括一系列有用的功能和信息用以辅助开发者收集和捕获它们应用程序的重要信息。例如当网页发生错误时获知错误是何时发生的有助于帮助解决错误而浏览器 DevTools 就可以被配置来捕获这个信息。
#### 主流浏览器和 DevTools
- [Edge](https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium?WT.mc_id=academic-13441-cxa)
- [Chrome](https://developers.google.com/web/tools/chrome-devtools/)
- [Firefox](https://developer.mozilla.org/docs/Tools)
### 命令行工具Command Line Tools
一些开发者更喜欢使用较少的图形化界面来执行日常任务,因此选择使用命令行。开发代码需要大量的文字输入,一些开发者不喜欢自己在键盘上的工作流被打断,会使用键盘快捷键来切换桌面窗口、切换工作文件、使用工具等。大多数任务都可以通过鼠标完成,而使用命令行的一个好处就是无需再鼠标和键盘之间切换就能完成多数工作。命令行的另一个好处是它们是可配置的,所以你可以保存你的配置并随时修改,还可以将其导入到新的开发设备上。但开发环境毕竟因人而异,有人完全不想用命令行,有人则希望在命令行做所有事,还有一些人两种方式都乐意接受。
### 常用命令行选择
命令行选择基于你使用的操作系统会有所不同。
*💻 表示会预装在对应操作系统上*
#### Windows
- [Powershell](https://docs.microsoft.com/powershell/scripting/overview?view=powershell-7?WT.mc_id=academic-13441-cxa) 💻
- [Command Line](https://docs.microsoft.com/windows-server/administration/windows-commands/windows-commands?WT.mc_id=academic-13441-cxa) (即 CMD) 💻
- [Windows Terminal](https://docs.microsoft.com/windows/terminal/?WT.mc_id=academic-13441-cxa)
- [mintty](https://mintty.github.io/)
#### MacOS
- [Terminal](https://support.apple.com/guide/terminal/open-or-quit-terminal-apd5265185d-f365-44cb-8b09-71a064a42125/mac) 💻
- [iTerm](https://iterm2.com/)
- [Powershell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell-core-on-macos?view=powershell-7?WT.mc_id=academic-13441-cxa)
#### Linux
- [Bash](https://www.gnu.org/software/bash/manual/html_node/index.html) 💻
- [KDE Konsole](https://docs.kde.org/trunk5/en/applications/konsole/index.html)
- [Powershell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7?WT.mc_id=academic-13441-cxa)
#### 常用命令行工具
- [Git](https://git-scm.com/) (💻 <- 在多数操作系统上)
- [NPM](https://www.npmjs.com/)
- [Yarn](https://classic.yarnpkg.com/en/docs/cli/)
### 文档
当一位开发者想要学点新东西他们基本都会去找文档Documentation来学习如何使用。开发者会依靠文档来指引他们如何合理地使用工具和语言并且从中获取更多关于实现原理的深层知识。
#### Web 开发常用文档
- [Mozilla Developer Network](https://developer.mozilla.org/docs/Web)
- [Frontend Masters](https://frontendmasters.com/learn/)
✅ 查一查:既然你已经对 Web 开发者的环境有所了解,何不比较一下其与 Web 设计师的环境的差异?
---
## 🚀 挑战
比较一些编程语言。JavaScript 和 Java 相互之间有什么独特的特征COBOL 和 Go 之间呢?
## 课后小测
[课后小测](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/2?loc=zh_cn)
## 复习 & 自学
尝试接触一些不同的编程语言,用一种语言写一行代码,然后用另外两种语言重写这一行代码,你有什么感悟吗?
## 作业
[阅读文档](assignment.zh-cn.md)

@ -0,0 +1,193 @@
# 程式語言概論與必備工具
這堂課程解釋程式語言的基礎。這項主題能應用到當代多數的程式語言。關於必備工具的部分,你會學到許多實用的開發者軟體。
![關於程式語言](/sketchnotes/webdev101-programming.png)
> 由[Tomomi Imura](https://twitter.com/girlie_mac) 繪製。
## 課前測驗
[課前測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/1?loc=zh_tw)
## 大綱
在這堂課中,包含:
- 什麼是程式設計?
- 程式語言的種類
- 程式的基本架構
- 給專業開發者的實用軟體與工具
## 什麼是程式設計?
程式設計又稱作Coding是編寫電腦或手機裝置的指令過程。我們以裝置看得懂的程式語言來編寫這些指令這些指令集涉及到常見的*程式*、*電腦程式*、*應用程式(App)*或*執行檔*。
一個*程式*以程式碼任意創作出來,網頁、遊戲、手機應用都是程式的一種。雖然我們可以在不編寫程式碼的情況下建出程式,但裝置底下的邏輯概念還是以程式碼為主。一個*執行中*、*執行編碼*的程式都是仰賴著指令。你眼前正閱讀的文字就是由程式輸出到螢幕。
✅ 課外研究: 誰被認為是世界上第一位電腦工程師?
## 撰寫程式語言
編寫程式語言的主要目的是讓開發者得以指示裝置。裝置只能讀懂二元格式 ( 1 與 0 ),對於*大多數*的開發者而言,這並不是個很好理解溝通的方式。程式語言就像人類與電腦之間溝通的橋梁。
程式語言有不同的格式與滿足的目的。舉例來說JavaScript 常被用在網頁應用上,而 Bash 主要是用在作業系統上。
*低階語言(Low level languages)* 通常比 *高階語言(high level languages)* 要求更少的裝置指示步數。然而高階語言的閱讀性與支援性讓它成為最普及的程式語言。JavaScript 即是一種高階語言。
下列程式碼說明高階語言(JavaScript)與低階語言(ARM assembly code)的差異:
```javascript
let number = 10
let n1 = 0, n2 = 1, nextTerm;
for (let i = 1; i <= number; i++) {
console.log(n1);
nextTerm = n1 + n2;
n1 = n2;
n2 = nextTerm;
}
```
```c
area ascen,code,readonly
entry
code32
adr r0,thumb+1
bx r0
code16
thumb
mov r0,#00
sub r0,r0,#01
mov r1,#01
mov r4,#10
ldr r2,=0x40000000
back add r0,r1
str r0,[r2]
add r2,#04
mov r3,r0
mov r0,r1
mov r1,r3
sub r4,#01
cmp r4,#00
bne back
end
```
事實上,*他們都做一樣的事情* ── 印出前十項費氏數列。
✅ 費氏數列的[定義](https://zh.wikipedia.org/zh-tw/%E6%96%90%E6%B3%A2%E9%82%A3%E5%A5%91%E6%95%B0%E5%88%97)為該數是由之前的兩數相加而得出。初始值為 0 與 1。
## 程式的基本架構
程式中的一行指令(instruction)被稱做*陳述式(statement)*,通常會由特定符號或分行來決定結尾處,或是執行*程式終止*。程式終止的方式會依不同程式語言而有所不同。
大多數程式需要使用用戶或其他位置的資料,陳述式依照這些資料決定指令。資料會影響程式的運作方式,編寫程式語言便是一種暫時性儲存資料的途徑。這些資料稱為*變數(Variables)*。變數會指引資料儲存到裝置上的位置,它們就像代數一樣:有自己的名稱、數值隨時間改變。
有些情況裝置不會執行到陳述式。通常是開發者故意的選擇或意外性地輸入錯誤,讓應用程式變得更豐富且需要被維護。常見的發生情況在決定條件的時候,如當代程式語言以 `if..else` 條件式來決定程式的執行方式。
✅ 往後的課程會講解各式各樣的陳述式型態。
## 工欲善其事,必先利其器
[![謀生工具 Tools of the Trade](https://img.youtube.com/vi/69WJeXGBdxg/0.jpg)](https://youtube.com/watch?v=69WJeXGBdxg "謀生工具 Tools of the Trade")
在這個章節,你會學習到一些實用的軟體來開始你的開發旅程。
一個**開發環境**包含許多開發者撰寫程式需要用到的工具。它們會依照開發者的需求而不同,隨著時間、專案大小、程式語言而有所調整。每個開發者都有自己獨特的開發環境。
### 文字編輯器
文字編輯器可說是最重要的軟體開發工具。開發者可以在其中撰寫並執行程式。
還有許多原因讓開發者選擇文字編輯器:
- *偵錯(Debugging)* 在程式碼中一行一行地找尋錯誤。有些文字編輯器有偵錯的功能,可以依照不同的程式語言而調整。
- *語法突顯(Syntax highlighting)* 將程式碼加上顏色並自動排版,方便開發者閱讀。文字編輯器也支援語法突顯的客製化。
- *整合擴充插件(Extensions and Integrations)* 擴充插件不包含在預設的文字編輯器當中,開發者依照自己的需求建立並新增到文字編輯器當中。舉例來說,許多開發者需要統整程式文檔並註解這些檔案,他們就會加裝檢查拼字的插件。有些插件功能只支援特定的文字編輯器,文字編輯器也提供搜尋擴充插件的功能。
- *客製化(Customization)* 大多數的文字編輯器都允許開發者做客製化,開發者依照自己的習慣,建立自己順手的開發環境。其中也包含建立自己的擴充插件。
#### 常見文字編輯器與網頁開發插件
- [Visual Studio Code](https://code.visualstudio.com/)
- [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
- [Live Share](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare-pack)
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [Atom](https://atom.io/)
- [spell-check](https://atom.io/packages/spell-check)
- [teletype](https://atom.io/packages/teletype)
- [atom-beautify](https://atom.io/packages/atom-beautify)
### 瀏覽器
另一款重要的工具是瀏覽器。網頁開發人員會藉由瀏覽器觀察程式的執行情況,瀏覽器也是常見的網頁編輯與檢視器,顯示來自檔案的可見物件,如 HTML 檔。
許多瀏覽器都附加*開發者工具(DevTools)*,內含實用的功能協助開發者蒐集與取得重要的程式資訊。假設有一頁網頁出現錯誤,了解它出錯的時間與狀況就很重要,配置開發者工具即可蒐集這些資訊。
#### 常見瀏覽器與網頁開發工具
- [Edge](https://docs.microsoft.com/microsoft-edge/devtools-guide-chromium?WT.mc_id=academic-13441-cxa)
- [Chrome](https://developers.google.com/web/tools/chrome-devtools/)
- [Firefox](https://developer.mozilla.org/docs/Tools)
### 常用指令
有些開發者偏好較少的介面,通常會使用指令來完成工作;撰寫程式碼要求大量的文字輸入,有些開發者偏好以不中斷文字輸入為首要條件,常用快捷鍵做視窗與檔案的切換。多數工作能以滑鼠操作,但為了減少鍵盤與滑鼠間的切換,指令輸入會是實踐上較合適的方式。另一項指令輸入的好處是它們彈性很高,隨時可以更新設定,甚至移植到其他機器上。每一位開發者有各自的開發習慣,開發環境也有所不同。
### 常用指令選項
指令選項(Command Line Options)會依不同的作業系統而有所不同。
*💻 表示預設已安裝在作業系統上。*
#### Windows
- [Powershell](https://docs.microsoft.com/powershell/scripting/overview?view=powershell-7?WT.mc_id=academic-13441-cxa) 💻
- [Command Line](https://docs.microsoft.com/windows-server/administration/windows-commands/windows-commands?WT.mc_id=academic-13441-cxa) (又稱作 CMD) 💻
- [Windows Terminal](https://docs.microsoft.com/windows/terminal/?WT.mc_id=academic-13441-cxa)
- [mintty](https://mintty.github.io/)
#### MacOS
- [Terminal](https://support.apple.com/guide/terminal/open-or-quit-terminal-apd5265185d-f365-44cb-8b09-71a064a42125/mac) 💻
- [iTerm](https://iterm2.com/)
- [Powershell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell-core-on-macos?view=powershell-7?WT.mc_id=academic-13441-cxa)
#### Linux
- [Bash](https://www.gnu.org/software/bash/manual/html_node/index.html) 💻
- [KDE Konsole](https://docs.kde.org/trunk5/en/applications/konsole/index.html)
- [Powershell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7?WT.mc_id=academic-13441-cxa)
#### 其他常用指令
- [Git](https://git-scm.com/) (💻 已支援大多數的作業系統。)
- [NPM](https://www.npmjs.com/)
- [Yarn](https://classic.yarnpkg.com/en/docs/cli/)
### 技術文件
若開發人員想學新的事物,技術文件會是很好的幫手。他們會參照文件來學習如何使用工具與新的程式語言,並瞭解如何鑽研更深入的用法。
#### 常用的網頁開發文件
- [Mozilla Developer Network](https://developer.mozilla.org/docs/Web)
- [Frontend Masters](https://frontendmasters.com/learn/)
✅ 研究項目: 現在你已經了解基本的網頁開發環境了。請比較「網頁開發環境」與「網頁設計環境」之間的差異。
---
## 🚀 挑戰
比較不同的程式語言: JavaScript 與 Java 間有什麼獨特的特徵? 那 COBOL 與 Go 呢?
## 課後測驗
[課後測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/2?loc=zh_tw)
## 複習與自學
學習不同的程式語言。試著在三種不同的程式語言寫幾行程式碼。你學到了什麼?
## 作業
[閱讀技術文件](assignment.zh-tw.md)

@ -0,0 +1,11 @@
# Lire la documentation
## Instructions
Un développeur Web peut avoir besoin de nombreux outils qui se trouvent sur le [Documentation MDN pour l'outillage côté client](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Sélectionnez 3 outils non traités dans la leçon, expliquez pourquoi un développeur Web l'utiliserait, recherchez un outil qui relève de cette catégorie et partagez sa documentation. N'utilisez pas le même exemple d'outil sur les documents MDN.
## Rubrique
Exemplaire | Adéquat | A besoin d'amélioration
--- | --- | -- |
| Expliqué pourquoi le développeur Web utiliserait l'outil | Expliqué comment, mais pas pourquoi le développeur utiliserait l'outil | N'a pas mentionné comment ou pourquoi un développeur utiliserait l'outil |

@ -2,7 +2,7 @@
## Οδηγίες
Υπάρχουν πολλά εργαλεία που μπορεί να χρειαστεί ένας web developer και τα οποία βρίσκονται στο [MDN έγγραφα για client-side tooling](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Επιλέξτε 3 εργαλεία που δεν αναφέρονται στο μάθημα, εξηγήστε γιατί θα τα χρησιμοποιούσε ένας web developer, αναζητήστε ένα εργαλείο που ανήκει σε αυτήν την κατηγορία και μοιραστείτε την τεκμηρίωσή σας. Μην χρησιμοποιήσετε το ίδιο παράδειγμα εργαλείου που αναφέρεται στα έγγραφα MDN.
Υπάρχουν πολλά εργαλεία που μπορεί να χρειαστεί ένας web developer και τα οποία βρίσκονται στο [MDN έγγραφα για client-side tooling](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Επιλέξτε 3 εργαλεία που δεν αναφέρονται στο μάθημα, εξηγήστε γιατί θα τα χρησιμοποιούσε ένας web developer, αναζητήστε ένα εργαλείο που ανήκει σε αυτήν την κατηγορία και μοιραστείτε την τεκμηρίωσή σας. Μην χρησιμοποιήσετε το ίδιο παράδειγμα εργαλείου που αναφέρεται στα έγγραφα MDN.
##

@ -2,7 +2,7 @@
## अनुदेश
ऐसे कई उपकरण हैं जिनकी आवश्यकता वेब डेवलपर को हो सकती है जो [एमडीएन प्रलेखन के क्लाइंट-साइड टूलिंग](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview) पे उपलब्ध है । पाठ में शामिल नहीं किए गए 3 टूल चुनें, बताएं कि एक वेब डेवलपर इसका उपयोग क्यों करेगा, और इस टूल के लिए खोज करेगा जो इस श्रेणी में आता है और इसके प्रलेखन को साझा करता है । MDN डॉक्स पर समान टूल उदाहरण का उपयोग न करें.
ऐसे कई उपकरण हैं जिनकी आवश्यकता वेब डेवलपर को हो सकती है जो [एमडीएन प्रलेखन के क्लाइंट-साइड टूलिंग](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview) पे उपलब्ध है । पाठ में शामिल नहीं किए गए 3 टूल चुनें, बताएं कि एक वेब डेवलपर इसका उपयोग क्यों करेगा, और इस टूल के लिए खोज करेगा जो इस श्रेणी में आता है और इसके प्रलेखन को साझा करता है । MDN डॉक्स पर समान टूल उदाहरण का उपयोग न करें.
## सरनामा

@ -2,7 +2,7 @@
## Instruksi
Ada banyak alat yang mungkin diperlukan pengembang web yang ada di [dokumentasi MDN untuk alat sisi klien](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview) . Pilih 3 alat yang tidak tercakup dalam pelajaran, jelaskan mengapa pengembang web akan menggunakannya, dan cari alat yang termasuk dalam kategori ini dan bagikan dokumentasinya. Jangan gunakan contoh alat yang sama pada dokumen MDN.
Ada banyak alat yang mungkin diperlukan pengembang web yang ada di [dokumentasi MDN untuk alat sisi klien](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview) . Pilih 3 alat yang tidak tercakup dalam pelajaran, jelaskan mengapa pengembang web akan menggunakannya, dan cari alat yang termasuk dalam kategori ini dan bagikan dokumentasinya. Jangan gunakan contoh alat yang sama pada dokumen MDN.
## Rubrik

@ -2,7 +2,7 @@
## Istruzioni
Ci sono molti strumenti dei quali uno sviluppatore web potrebbe avere bisogno che non sono nella [documentazione MDN per strumenti lato client](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Selezionare 3 strumenti non trattati nella lezione, spiegare perchè uno sviluppatore web dovrebbe usarli, cercare uno strumento che possa rientrare in questa categoria e condivere la sua documentazione. Non usare lo stesso strumento di esempio citato nei documenti MDN.
Ci sono molti strumenti dei quali uno sviluppatore web potrebbe avere bisogno che non sono nella [documentazione MDN per strumenti lato client](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Selezionare 3 strumenti non trattati nella lezione, spiegare perchè uno sviluppatore web dovrebbe usarli, cercare uno strumento che possa rientrare in questa categoria e condivere la sua documentazione. Non usare lo stesso strumento di esempio citato nei documenti MDN.
## Rubrica

@ -2,7 +2,7 @@
## 説明書
Web 開発者が必要とする可能性のあるツールは、[クライアントサイドツールの MDN ドキュメント](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview)に記載されているものが多くあります。このレッスンでカバーされていないツールを3つ選び、Web 開発者がそれを使う理由を説明し、このカテゴリに該当するツールを検索し、そのドキュメントを共有してください。同じツールの例を MDN ドキュメント上で使用しないでください。
Web 開発者が必要とする可能性のあるツールは、[クライアントサイドツールの MDN ドキュメント](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview)に記載されているものが多くあります。このレッスンでカバーされていないツールを3つ選び、Web 開発者がそれを使う理由を説明し、このカテゴリに該当するツールを検索し、そのドキュメントを共有してください。同じツールの例を MDN ドキュメント上で使用しないでください。
## ルーブリック

@ -2,7 +2,7 @@
## 설명
웹 개발자들이 필요할 만한 도구들이 [MDN 클라이언트 사이드 도구 문서](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview)에 소개되어있습니다. 이번 수업내용에 포함되지 않은 3개의 도구를 선택하고, 왜 웹 개발자들이 사용할만한지를 설명해봅시다. 그리고 이 범주에 속하는 도구를 찾아서 문서를 공유해봅시다. MDN문서에 있는 똑같은 예시를 사용하면 안 됩니다.
웹 개발자들이 필요할 만한 도구들이 [MDN 클라이언트 사이드 도구 문서](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview)에 소개되어있습니다. 이번 수업내용에 포함되지 않은 3개의 도구를 선택하고, 왜 웹 개발자들이 사용할만한지를 설명해봅시다. 그리고 이 범주에 속하는 도구를 찾아서 문서를 공유해봅시다. MDN문서에 있는 똑같은 예시를 사용하면 안 됩니다.
## 평가 기준

@ -1,7 +1,7 @@
# Membaca Docs
## Arahan
Terdapat banyak alat yang mungkin diperlukan oleh pembangun web adalah di [Dokumentasi MDN untuk perkakas sisi pelanggan](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Pilih 3 alat yang tidak diliputi dalam pelajaran, terangkan mengapa pembangun web menggunakannya, dan mencari alat yang terdapat dalam kategori ini dan kongsikan dokumentasinya. Jangan menggunakan contoh alat yang sama pada MDN.
Terdapat banyak alat yang mungkin diperlukan oleh pembangun web adalah di [Dokumentasi MDN untuk perkakas sisi pelanggan](https://developer.mozilla.org/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Pilih 3 alat yang tidak diliputi dalam pelajaran, terangkan mengapa pembangun web menggunakannya, dan mencari alat yang terdapat dalam kategori ini dan kongsikan dokumentasinya. Jangan menggunakan contoh alat yang sama pada MDN.
## Rubrik

@ -0,0 +1,11 @@
# De Documenten lezen
## Instructies
Er zijn veel tools die een webontwikkelaar nodig heeft en die staan in de [MDN-documentatie voor client-side tooling](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview). Selecteer 3 tools die niet in de les worden behandeld, leg uit waarom een webontwikkelaar deze zou gebruiken en zoek naar een tool die onder deze categorie valt en deel de documentatie ervan. Gebruik niet hetzelfde toolvoorbeeld voor MDN-documenten.
## Rubriek
Voorbeeldig | Voldoende | Moet Worden Verbeterd
--- | --- | -- |
|Uitgelegd waarom webontwikkelaar een tool zou gebruiken| Uitgelegd hoe, maar niet waarom de ontwikkelaar de tool zou gebruiken| Niet vermeld hoe of waarom een ontwikkelaar een tool zou gebruiken |

@ -0,0 +1,11 @@
# 阅读文档
## 说明
[MDN 客户端工具文档](https://developer.mozilla.org/zh-CN/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview)中介绍了需要 Web 开发者可能需要用到的工具。从中选取三种本节课中没有提到的工具,并说明为什么 Web 开发者需要用到它们,搜索其中一种工具并给出它的文档。不要直接使用 MDN 中给出的示例。
## 评价表
| 优秀 | 良好 | 尚可进步 |
| --- | --- | -- |
| 解释了 Web 开发者为什么需要这些工具 | 解释了开发者如何使用这些工具,但却没有解释为什么需要它们 | 既没有解释为什么使用这些工具,也没有给出使用它们的方法 |

@ -0,0 +1,11 @@
# 閱讀技術文件
## 說明
網頁開發人員所需要使用的工具套件可以參考 [MDN Client端技術開發文件](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Overview)。 請選擇三種未被本課程提及的工具,試解釋為何網頁開發人員使用它,並搜尋其相關的工具與它的技術文件。這些資料不能出現在前述的 MDN 文件當中。
## 學習評量
| 優良 | 普通 | 待改進 |
| ------------------------------ | -------------------- | ------------------------------ |
| 解釋為何網頁開發人員會用此工具 | 只解釋工具的使用方法 | 未提及工具的使用意義與使用方法 |

@ -2,7 +2,7 @@
This lesson covers the basics of GitHub, a platform to host and manage changes to your code.
![Intro to GitHub](images/webdev101-github.png)
![Intro to GitHub](/sketchnotes/webdev101-github.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz

@ -1,6 +1,9 @@
# Introducción a GitHub
Esta lección cubre los conceptos básicos de GitHub, una plataforma para alojar y administrar cambios en su código.
Esta lección cubre los conceptos básicos de GitHub, una plataforma para alojar y administrar cambios en tu código.
![Intro to GitHub](/sketchnotes/webdev101-github.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## [Pre-lecture prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/3)
@ -8,64 +11,64 @@ Esta lección cubre los conceptos básicos de GitHub, una plataforma para alojar
En esta lección, cubriremos:
- seguimiento del trabajo que realiza en su máquina
- dando seguimiento al trabajo que realizas en tu máquina
- trabajar en proyectos con otros
- cómo contribuir al software de código abierto
- cómo contribuir al software de código abierto (open source)
### Prerrequisitos
Antes de comenzar, deberá verificar si Git está instalado. En el tipo de terminal:
Antes de comenzar, verifica si Git está instalado. Escribe en tu terminal:
`git --version`
Si Git no está instalado, [descargar Git](https://git-scm.com/downloads). Luego, configure su perfil de Git local en la terminal:
Si Git no está instalado, [descarga Git aquí](https://git-scm.com/downloads). Luego, configura tu perfil de Git local en la terminal:
`git config --global user.name "tu-nombre"`
`git config --global user.email "tu-email"`
Para comprobar si Git ya está configurado, puede escribir:
Para comprobar si Git ya está configurado, escribe:
`git config --list`
También necesitará una cuenta de GitHub, un editor de código (como Visual Studio Code) y deberá abrir su terminal (o: símbolo del sistema).
También necesitarás una cuenta de GitHub, un editor de código (como Visual Studio Code) y deberás abrir tu terminal.
Vaya a [github.com](https://github.com/) y cree una cuenta si aún no lo ha hecho, o inicie sesión y complete su perfil.
Ve a [github.com](https://github.com/) y crea una cuenta si aún no lo has hecho, o inicia sesión y completa tu perfil.
✅ GitHub no es el único repositorio de código del mundo; hay otros, pero GitHub es el más conocido.
### Preparación
Necesitará una carpeta con un proyecto de código en su máquina local (computadora portátil o PC) y un repositorio público en GitHub, que le servirá como ejemplo de cómo contribuir a los proyectos de otros.
Necesitarás una directorio con un proyecto de código en tu máquina local (computadora portátil o PC) y un repositorio público en GitHub, que te servirá como ejemplo de cómo contribuir a los proyectos de otros.
---
## Gestión de código
Digamos que tiene una carpeta localmente con algún proyecto de código y desea comenzar a rastrear su progreso usando git, el sistema de control de versiones. Algunas personas comparan el uso de git con escribir una carta de amor a su yo futuro. Al leer sus mensajes de confirmación días, semanas o meses después, podrá recordar por qué tomó una decisión o "revertir" un cambio, es decir, cuando escribe buenos "mensajes de confirmación".
Digamos que tienes una directorio local con algún proyecto de código y deseas rastrear tu progreso usando git, el sistema de control de versiones. Algunas personas comparan el uso de git con escribir una carta de amor a tu futuro. Al leer tus mensajes de confirmación días, semanas o meses después, podrás recordar por qué tomaste una decisión o "revertiste" un cambio, es decir, cuando escribes buenos "mensajes de confirmación".
### Tarea: hacer un repositorio y enviar código
### Tarea: hacer un repositorio git y enviar código
1. **Crear repositorio en GitHub**. En GitHub.com, en la pestaña de repositorios, o en la barra de navegación superior derecha, busque el botón **nuevo repositorio**.
1. **Crear repositorio en GitHub**. En GitHub.com, en la pestaña de repositorios, o en la barra de navegación superior derecha, busca el botón **nuevo repositorio**.
1. Dale un nombre a tu repositorio (carpeta)
1. Seleccione **crear repositorio**.
1. Dale un nombre a tu repositorio (directorio)
1. Selecciona **crear repositorio**.
1. **Navegue a su carpeta de trabajo**. En su terminal, cambie a la carpeta (también conocida como directorio) que desea comenzar a rastrear. Tipo:
1. **Navegue a su directorio de trabajo**. En tu terminal, cambia a la directorio (también conocida como directorio) que deseas comenzar a rastrear. Escribe:
```bash
cd [nombre de tu carpeta]
cd [nombre de tu directorio]
```
1. **Inicializar un repositorio de git**. En su tipo de proyecto:
1. **Inicializar un repositorio de git**. En tu proyecto escribe:
```bash
git init
```
1. **Comprobar estado**. Para comprobar el estado de su tipo de repositorio:
1. **Comprobar estado**. Para checar el estado del proyecto escribe:
```bash
git status
```
la salida puede verse así:
La respuesta de la terminal (CLI) probablemente se verá así:
```output
Changes not staged for commit:
@ -76,7 +79,7 @@ Digamos que tiene una carpeta localmente con algún proyecto de código y desea
modified: file2.txt
```
Por lo general, un comando `git status` le dice cosas como qué archivos están listos para ser guardados en el repositorio o tiene cambios que es posible que desee conservar.
Por lo general, un comando `git status` te dice cosas como qué archivos están listos para ser guardados en el repositorio o cambios en tu codigo que puedes conservar.
1. **Agregar archivos al seguimiento**
@ -84,27 +87,25 @@ Digamos que tiene una carpeta localmente con algún proyecto de código y desea
git add .
```
El argumento `git add` más `.` indica que todos sus archivos y cambios para el seguimiento.
El argumento `git add` más `.` indica que todos tus archivos y cambios están listos para darles seguimiento.
1. **Persistir en tu trabajo**. En este punto, ha agregado los archivos a lo que se denomina _área de preparación_. Un lugar donde Git rastrea sus archivos. Para que el cambio sea permanente, debe _commitir_ los archivos. Para hacerlo, crea un _commit_ con el comando `git commit`. Un _commit_ representa un punto de ahorro en el historial de su repositorio. Escriba lo siguiente para crear un _commit_:
1. **Persistir en tu trabajo**. En este punto, has agregado los archivos a lo que se denomina _área de preparación_. Un lugar donde Git rastrea tus archivos. Para que el cambio sea permanente, debes _commitir_ los archivos. Para hacerlo, creas un _commit_ con el comando `git commit`. Un _commit_ representa un punto en el historial de tu repositorio que estás guardando. Escribe lo siguiente para crear un _commit_:
```bash
git commit -m "first commit"
```
Esto confirma todos sus archivos, agregando el mensaje "primer compromiso". Para futuros mensajes de confirmación, querrá ser más descriptivo en su descripción para transmitir qué tipo de cambio ha realizado.
1. **Conecte su repositorio de Git local con GitHub**. Un repositorio de Git es bueno en su máquina, pero en algún momento desea tener una copia de seguridad de sus archivos en algún lugar y también invitar a otras personas a trabajar con usted en su repositorio. Un gran lugar para hacerlo es GitHub. Recuerde que ya hemos creado un repositorio en GitHub, por lo que lo único que debemos hacer es conectar nuestro repositorio de Git local con GitHub. El comando `git remote add` hará precisamente eso. Escriba el siguiente comando:
Esto confirma todos tus archivos, agregando el mensaje "primer compromiso". Para futuros mensajes de confirmación, querrás ser más descriptivo en tu descripción para transmitir qué tipo de cambio has realizado.
1. **Conecta tu repositorio de Git local con GitHub**. Es bueno tener un repositorio de Git en tu máquina, pero también tienes que guarder todos sus archivos en algún lugar e invitar a otras personas a trabajar contigo en tu repositorio. Un buen lugar para hacerlo es GitHub. Recuerda que ya hemos creado un repositorio en GitHub, por lo que lo único que debemos hacer es conectar nuestro repositorio de Git local con GitHub. El comando `git remote add` hará precisamente eso. Escribe el siguiente comando:
> Tenga en cuenta que antes de escribir el comando, vaya a la página de su repositorio de GitHub para encontrar la URL del repositorio. Lo usará en el siguiente comando. Reemplaza `repository_name` con tu URL de GitHub.
> Nota, antes de escribir el comando, ve a la página de tu repositorio de GitHub para encontrar el URL del repositorio. Lo usarás en el siguiente comando. Reemplaza `repository_name` con tu URL de GitHub.
```bash
git remote add origin https://github.com/username/repository_name.git
```
Esto crea un _remote_, o conexión, llamado "origin" que apunta al repositorio de GitHub que creó anteriormente.
Esto crea un _remote_, o conexión, llamado "origin" que apunta al repositorio de GitHub que creaste anteriormente.
1. **Envía archivos locales a GitHub**. Hasta ahora ha creado una _conexión_ entre el repositorio local y el repositorio de GitHub. Enviemos estos archivos a GitHub con el siguiente comando `git push`, así:
@ -113,9 +114,9 @@ Digamos que tiene una carpeta localmente con algún proyecto de código y desea
git push -u origin main
```
Esto envía sus confirmaciones en su rama "principal" a GitHub.
Esto envía una confirmación en tu rama "principal" a GitHub.
1. **Para agregar más cambios**. Si desea continuar haciendo cambios y enviarlos a GitHub, solo necesita usar los siguientes tres comandos:
1. **Para agregar más cambios**. Si deseas continuar haciendo cambios y enviarlos a GitHub, solo necesitas usar los siguientes tres comandos:
```bash
git add .
@ -123,83 +124,84 @@ Digamos que tiene una carpeta localmente con algún proyecto de código y desea
git push
```
> Sugerencia: es posible que también desee adoptar un archivo `.gitignore` para evitar que los archivos que no desea rastrear aparezcan en GitHub, como el archivo de notas que almacena en la misma carpeta pero no tiene lugar para escribir su mensaje de confirmación aquí repositorio público. Puede encontrar plantillas para archivos `.gitignore` en [.gitignore templates](github.com/github/gitignore).
> Sugerencia: es posible que también desees adoptar un archivo `.gitignore` para evitar que los archivos que no deseas rastrear aparezcan en GitHub. Puedes encontrar plantillas para archivos `.gitignore` en [.gitignore templates](github.com/github/gitignore).
#### Confirmar mensajes
Una gran línea de asunto de confirmación de Git completa la siguiente oración:
Una buena línea de asunto (subject line) de confirmación de Git completa la siguiente oración:
Si se aplica, esta confirmación será <su línea de asunto aquí>
Para el sujeto use el imperativo, tiempo presente: "cambiar" no "cambiar" ni "cambiar".
Para el sujeto use el imperativo, tiempo presente: "cambiar" no "cambió" ni "cambiara".
Como en el sujeto, en el cuerpo (opcional) también use el imperativo, presente. El cuerpo debe incluir la motivación para el cambio y contrastarla con la conducta anterior. Estás explicando el "por qué", no el "cómo".
✅ Tómate unos minutos para navegar por GitHub. ¿Puedes encontrar un mensaje de compromiso realmente bueno? ¿Puedes encontrar uno realmente mínimo? ¿Qué información crees que es la más importante y útil de transmitir en un mensaje de compromiso?
### Tarea: Colaborar
La razón principal para poner cosas en GitHub fue hacer posible la colaboración con otros desarrolladores.
## Trabajando en proyectos con otros
En su repositorio, vaya a `Insights > Community` para ver cómo se compara su proyecto con los estándares comunitarios recomendados.
En tu repositorio, ve a `Insights > Community` para ver cómo se compara tu proyecto con los estándares comunitarios recomendados.
Aquí hay algunas cosas que pueden mejorar su repositorio de GitHub:
Aquí hay algunas cosas que pueden mejorar tu repositorio de GitHub:
- **Descripción**. ¿Agregaste una descripción para tu proyecto?
- **README**. ¿Agregaste un archivo README? GitHub proporciona una guía para escribir un [README](https://docs.github.com/articles/about-readmes/).
- **Pauta de contribución**. ¿Su proyecto tiene [pautas de contribución](https://docs.github.com/articles/setting-guidelines-for-repository-contributors/),
- **Código de Conducta**. un [Código de conducta](https://docs.github.com/articles/adding-a-code-of-conduct-to-your-project/),
- **Licencia**. Quizás lo más importante, una [licencia](https://docs.github.com/articles/adding-a-license-to-a-repository/)?
- **Guía de contribución**. ¿Tiene [guías de contribución](https://docs.github.com/articles/setting-guidelines-for-repository-contributors/) tu proyecto?
- **Código de Conducta**. Crea un [Código de conducta](https://docs.github.com/articles/adding-a-code-of-conduct-to-your-project/).
- **Licencia**. Quizás lo más importante, una [licencia](https://docs.github.com/articles/adding-a-license-to-a-repository/).
Todos estos recursos beneficiarán la incorporación de nuevos miembros del equipo. Y esos son típicamente el tipo de cosas que los nuevos colaboradores miran antes incluso de mirar su código, para descubrir si su proyecto es el lugar adecuado para que ellos pasen su tiempo.
Todos estos recursos beneficiarán la incorporación de nuevos miembros del equipo. Y esos son típicamente el tipo de cosas que los nuevos colaboradores miran antes incluso de mirar tu código, para descubrir si tu proyecto es el lugar adecuado para que ellos pasen su tiempo.
✅ Los archivos README, aunque requieren tiempo para prepararse, a menudo son descuidados por los ocupados mantenedores. ¿Puede encontrar un ejemplo de uno particularmente descriptivo? Nota: hay algunas [herramientas para ayudar a crear buenos archivos READMEs](https://www.makeareadme.com/) que le gustaría probar.
✅ Los archivos README, aunque requieren tiempo para prepararse, a menudo son descuidados por los mantenedores. ¿Puedes encontrar un ejemplo de uno particularmente descriptivo? Nota: aquí hay algunas [herramientas para ayudar a crear buenos archivos READMEs](https://www.makeareadme.com/) que te puedes probar.
### Tarea: Fusionar código
### Tarea: Fusionar (merging) código
Los documentos que contribuyen ayudan a las personas a contribuir al proyecto. Explica qué tipos de contribuciones está buscando y cómo funciona el proceso. Los colaboradores deberán seguir una serie de pasos para poder contribuir a su repositorio en GitHub:
Los documentos que contribuyes ayudan a las personas a contribuir al proyecto. Explica qué tipos de contribuciones estás buscando y cómo funciona el proceso. Los colaboradores deberán seguir una serie de pasos para poder contribuir a tu repositorio en GitHub:
1. **Bifurcando su repositorio** Probablemente querrá que la gente _bifurque_ su proyecto. Bifurcar significa crear una réplica de su repositorio en su perfil de GitHub.
1. **Bifurcando (forking) tu repositorio** Probablemente querrás que la gente _bifurque_ (fork) tu proyecto. Bifurcar significa crear una réplica de tu repositorio en su perfil de GitHub.
1. **Clonar**. Desde allí, clonarán el proyecto en su máquina local.
1. **Crea una rama**. Querrá pedirles que creen una _ rama_ para su trabajo.
1. **Concentre su cambio en un área**. Pida a los colaboradores que concentren sus contribuciones en una cosa a la vez; de esa manera, las posibilidades de que pueda _fusionar_ en su trabajo son mayores. Imagine que escriben una corrección de errores, agregan una nueva función y actualizan varias pruebas; ¿qué sucede si lo desea o solo puede implementar 2 de 3 o 1 de 3 cambios?
1. **Crear una rama**. Querrás pedirles que creen una _ rama_ para su trabajo.
1. **Concentre su cambio en un área**. Pida a los colaboradores que concentren sus contribuciones en una cosa a la vez; de esa manera, las posibilidades de _fusionar_ su trabajo son mayores. Imagínate que escriben una corrección de errores, agregan una nueva función y actualizan varias pruebas; ¿qué sucede si quieres todos los cambios o solo puedes implementar 2 de 3 o 1 de 3 cambios?
✅ Imagine una situación en la que las sucursales son particularmente críticas para escribir y enviar un buen código. ¿En qué casos de uso se te ocurren?
✅ Imagínate una situación en la que las ramas (branches) de git son particularmente críticas para escribir y enviar buen código. ¿Qué casos de uso se te ocurren?
> Tenga en cuenta que sea el cambio que desea ver en el mundo y cree también sucursales para su propio trabajo. Todas las confirmaciones que realice se realizarán en la sucursal en la que está actualmente "registrado". Use `git status` para ver qué rama es esa.
> Se el cambio que deseas ver en el mundo y crea también ramas para tu propio trabajo. Todas las confirmaciones que realices se realizarán en la rama en la que estás actualmente "registrado". Usa `git status` para ver qué rama es.
Repasemos el flujo de trabajo de un colaborador. Suponga que el colaborador ya ha _bifurcado_ y _clonado_ el repositorio para que tenga un repositorio de Git listo para trabajar en su máquina local:
Repasemos el flujo de trabajo de un colaborador. Supon que el colaborador ya ha _bifurcado_ y _clonado_ el repositorio para que tenga un repositorio de Git listo para trabajar en su máquina local:
1. **Crea una rama**. Use el comando `git branch` para crear una rama que contendrá los cambios que pretenden contribuir:
1. **Crea una rama**. Usa el comando `git branch` para crear una rama que tendrá los cambios que quieres contribuir:
```bash
git branch [branch-name]
```
1. **Cambiar a rama de trabajo**. Cambie a la rama especificada y actualice el directorio de trabajo con `git checkout`:
1. **Cambiar a rama de trabajo**. Cambia a la rama especificada y actualiza tu directorio de trabajo con `git checkout`:
```bash
git checkout [branch-name]
```
1. **Trabaja**. En este punto, desea agregar sus cambios. No olvide informarle a Git con los siguientes comandos:
1. **Trabaja**. En este punto, deseas agregar tus cambios. No olvides informarle a Git con los siguientes comandos:
```bash
git add .
git commit -m "mis cambios"
```
Asegúrese de darle un buen nombre a su compromiso, por su bien y por el mantenedor del repositorio en el que está ayudando.
Asegúrate de darle un buen nombre a tu commit, tanto por tu bien como por el mantenedor del repositorio en el que estás ayudando.
1. **Combine su trabajo con la rama `principal`**. En algún momento ha terminado de trabajar y desea combinar su trabajo con el de la rama `principal`. La rama `main` podría haber cambiado mientras tanto, así que asegúrese de actualizarla primero a la última con los siguientes comandos:
1. **Combina tu trabajo con la rama `principal`**. En algún momento has terminado de trabajar y deseas combinar tu trabajo con el de la rama `principal`. La rama `main` podría haber cambiado mientras tanto, así que asegúrate de actualizarla con los siguientes comandos:
```bash
git checkout main
git pull
```
En este punto, querrá asegurarse de que cualquier _conflicto_, situaciones en las que Git no pueda _combinarse_ fácilmente los cambios, ocurra en su rama de trabajo. Por lo tanto, ejecute los siguientes comandos:
En este punto, querrás asegurarte de que cualquier _conflicto_, situaciones en las que Git no pueda _combinarse_ fácilmente los cambios, ocurren en tu rama de trabajo. Mientras tanto, ejecuta los siguientes comandos:
```bash
git checkout [branch_name]
@ -208,69 +210,69 @@ Repasemos el flujo de trabajo de un colaborador. Suponga que el colaborador ya h
Esto traerá todos los cambios de `main` a su rama y es de esperar que pueda continuar. De lo contrario, VS Code le dirá dónde está _confundido_ Git y simplemente modificará los archivos afectados para decir qué contenido es el más preciso.
1. **Envíe su trabajo a GitHub**. Enviar tu trabajo a GitHub significa dos cosas. Empujar su sucursal a su repositorio y luego abrir un PR, Pull Request.
1. **Envía tu trabajo a GitHub**. Enviar tu trabajo a GitHub significa dos cosas. Empujar tu rama a tu repositorio y luego abrir un PR (Pull Request).
```bash
git push --set-upstream origin [branch-name]
```
El comando anterior crea la rama en su repositorio bifurcado.
El comando anterior crea la rama en tu repositorio bifurcado.
1. **Abra una PR**. A continuación, desea abrir un PR. Para hacerlo, navegue al repositorio bifurcado en GitHub. Verá una indicación en GitHub donde le preguntará si desea crear un nuevo PR, haga clic en eso y lo llevará a una interfaz donde puede cambiar el título del mensaje de confirmación, asígnele una descripción más adecuada. Ahora, el mantenedor del repositorio que bifurcó verá este PR y _dedos cruzados_ apreciarán y _ fusionar_ su PR. Ahora eres un colaborador, yay :)
1. **Abre un PR**. A continuación, abre un PR. Para hacerlo, navega al repositorio bifurcado en GitHub. Verás una indicación en GitHub donde te preguntarán si deseas crear un nuevo PR. Haz clic en eso y lo llevará a una interfaz donde puedes cambiar el título del mensaje de confirmación, asignarle una descripción más adecuada. Ahora, el mantenedor del repositorio que bifurcaste verá este PR y _dedos cruzados_ apreciarán y _ fusionarán_ tu PR. Ahora eres un colaborador, yay :)
1. **Limpiar**. Se considera una buena práctica _limpiar_ después de ti. Desea limpiar tanto su sucursal local como la sucursal que envió a GitHub. Primero eliminémoslo localmente con el siguiente comando:
1. **Limpiar**. Se considera una buena práctica _limpiar_ después de ti. Limpiar tanto tu rama local como la rama que enviaste a GitHub. Primero eliminémoslo localmente con el siguiente comando:
```bash
git branch -d [branch-name]
```
Asegúrese de ir a la página de GitHub para el repositorio bifurcado a continuación y elimine la rama remota que acaba de ingresar.
Asegúrate de ir a la página de GitHub del repositorio bifurcado a continuación y elimina la rama remota que acabas de ingresar.
`Solicitud de extracción` parece un término tonto porque realmente desea impulsar los cambios al proyecto. Pero el mantenedor (propietario del proyecto) o el equipo central debe considerar sus cambios antes de fusionarlo con la rama "principal" del proyecto, por lo que realmente está solicitando una decisión de cambio a un mantenedor.
`Solicitud de extracción` parece un término tonto porque realmente deseas impulsar los cambios al proyecto. Pero el mantenedor (propietario del proyecto) o el equipo central debe considerar tus cambios antes de fusionarlo con la rama "principal" del proyecto, por lo que realmente estás solicitando una decisión de cambio a un mantenedor.
Una solicitud de extracción es el lugar para comparar y discutir las diferencias introducidas en una rama con revisiones, comentarios, pruebas integradas y más. Una buena solicitud de extracción sigue aproximadamente las mismas reglas que un mensaje de confirmación. Puede agregar una referencia a un problema en el rastreador de problemas, cuando su trabajo, por ejemplo, soluciona un problema. Esto se hace usando un '#' seguido del número de su problema. Por ejemplo, `#97`.
Una solicitud de extracción es el lugar para comparar y discutir las diferencias introducidas en una rama con revisiones, comentarios, pruebas integradas y más. Una buena solicitud de extracción sigue aproximadamente las mismas reglas que un mensaje de confirmación. Puedes agregar una referencia a un problema en el rastreador de problemas, cuando tu trabajo, por ejemplo, soluciona un problema. Esto se hace usando un '#' seguido del número de tu problema. Por ejemplo, `#97`.
🤞 Cruce los dedos para que todos los controles pasen y los propietarios del proyecto combinen sus cambios en el proyecto🤞
🤞 Cruza los dedos para que todos los controles pasen y los propietarios del proyecto combinen tus cambios en el proyecto🤞
Actualice su rama de trabajo local actual con todas las nuevas confirmaciones de la rama remota correspondiente en GitHub:
Actualice tu rama de trabajo local actual con todas las nuevas confirmaciones de la rama remota correspondiente en GitHub:
`git pull`
## Cómo contribuir al código abierto
Primero, busquemos un repositorio (o: repositorio) en GitHub que le interese y al que le gustaría contribuir con un cambio. Querrá copiar el contenido de a nuestra máquina.
Primero, busquemos un repositorio en GitHub que te interese y al que te gustaría contribuir con un cambio. Querrás copiar el contenido a nuestra máquina.
✅ Una buena forma de encontrar repositorios 'aptos para principiantes' es [buscar por la etiqueta `buena-primera-edición`](https://github.blog/2020-01-22-browse-good-first-issues-para-empezar-a-contribuir-al-código-abierto/).
Hay varias formas de copiar código. Una forma es "clonar" el contenido del repositorio, usando HTTPS, SSH o usando GitHub CLI (Interfaz de línea de comandos).
Abra su terminal y clone el repositorio así:
Abre tu terminal y clona el repositorio así:
`git clone https://github.com/ProjectURL`
Para trabajar en el proyecto, cambie a la carpeta correcta:
Para trabajar en el proyecto, cambia al directorio correcto:
`cd ProjectURL`
También puede abrir todo el proyecto utilizando [Codespaces](https://github.com/features/codespaces), el entorno de desarrollo en la nube / editor de código integrado de GitHub o [GitHub Desktop](https://desktop.github.com/).
También puedes abrir todo el proyecto utilizando [Codespaces](https://github.com/features/codespaces), el entorno de desarrollo en la nube / editor de código integrado de GitHub o [GitHub Desktop](https://desktop.github.com/).
Por último, puede descargar el código en una carpeta comprimida.
Por último, puedes descargar el código en un directorio comprimido.
### Algunas cosas más interesantes sobre GitHub
Puede destacar, ver y / o "fork" cualquier repositorio público en GitHub. Puede encontrar sus repositorios destacados en el menú desplegable de la parte superior derecha. Es como marcar como favorito, pero por código.
Puede destacar, ver y / o "fork" cualquier repositorio público en GitHub. Puedes encontrar tus repositorios destacados en el menú desplegable de la parte superior derecha. Es como marcar como favorito, pero por código.
Los proyectos tienen un rastreador de problemas, principalmente en GitHub en la pestaña "Issues" a menos que se indique lo contrario, donde las personas debaten los problemas relacionados con el proyecto. Y la pestaña Solicitudes de extracción es donde las personas debaten y revisan los cambios que están en curso.
Los proyectos también pueden tener discusiones en foros, listas de correo o canales de chat como Slack, Discord o IRC.
✅ Eche un vistazo a su nuevo repositorio de GitHub y pruebe algunas cosas, como editar la configuración, agregar información a su repositorio y crear un proyecto (como un tablero Kanban). ¡Hay muchas cosas que puedes hacer!
✅ Echa un vistazo a tu nuevo repositorio de GitHub y prueba algunas cosas, como editar la configuración, agregar información a tu repositorio y crear un proyecto (como un tablero Kanban). ¡Hay muchas cosas que puedes hacer!
🚀 Desafío: empareje con un amigo para trabajar en el código del otro. Cree un proyecto de forma colaborativa, bifurque el código, cree ramas y combine los cambios.
🚀 Desafío: empareja con un amigo(a) para trabajar en el código juntos. Crea un proyecto de forma colaborativa, bifurque el código, crea ramas y combina los cambios.
## [Post-lecture prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/4)
## Revisión y autoestudio
Obtenga más información sobre [contribución al software de código abierto](https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution).
Obtén más información sobre [contribución al software de código abierto](https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution).
[Hoja de referencia de Git](https://training.github.com/downloads/github-git-cheat-sheet/).
@ -278,6 +280,6 @@ Práctica práctica práctica. GitHub tiene excelentes rutas de aprendizaje disp
- [Primera semana en GitHub](https://lab.github.com/githubtraining/first-week-on-github)
También encontrará laboratorios más avanzados.
También encontrarás laboratorios más avanzados.
**Tarea**: Completa [la primera semana en el laboratorio de capacitación de GitHub](https://lab.github.com/githubtraining/first-week-on-github)

@ -2,7 +2,7 @@
Pelajaran ini mencakup dasar-dasar GitHub, platform untuk menghosting dan mengelola perubahan pada kode Anda.
![Dasar-dasar GitHub](images/webdev101-github.png)
![Dasar-dasar GitHub](/sketchnotes/webdev101-github.png)
> Catatan sketsa oleh [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuis Pra-Kuliah

@ -2,7 +2,7 @@
Questa lezione tratta delle basi di GitHub, una piattaforma per ospitare e gestire modifiche al proprio codice.
![Intro to GitHub](../images/webdev101-github.png)
![Intro to GitHub](/sketchnotes/webdev101-github.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz Pre-lezione

@ -2,7 +2,7 @@
이 강의에서는 코드 변경점을 호스팅하고 관리하는 플랫폼인 GitHub의 기본 사항을 다룹니다.
![Intro to GitHub](../images/webdev101-github.png)
![Intro to GitHub](/sketchnotes/webdev101-github.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## 강의 전 퀴즈

@ -2,7 +2,7 @@
Pelajaran ini merangkumi pengetahuan asas tentang GitHub, dan adalah salah satu platform untuk menjadi tuan rumah dan menguruskan perubahan pada kod anda.
![Intro to GitHub](../images/webdev101-github.png)
![Intro to GitHub](/sketchnotes/webdev101-github.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuiz Pra-Kuliah

@ -0,0 +1,318 @@
# Inleiding van GitHub
Deze les behandelt de basisprincipes van GitHub, een platform voor het hosten en beheren van wijzigingen in uw code.
![Intro to GitHub](/sketchnotes/webdev101-github.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz voorafgaand aan de lezing
[Quiz voorafgaand aan de lezing](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/3)
## Inleiding
In deze les behandelen we:
- het volgen van het werk dat u op uw machine doet
- samen met anderen aan projecten werken
- hoe u kunt bijdragen aan open source software
### Vereisten
Voordat u begint, moet u controleren of Git is geïnstalleerd. In het terminal typ:
`git --version`
Als Git niet is geïnstalleerd, [download Git](https://git-scm.com/downloads). Stel vervolgens uw lokale Git-profiel in de terminal in:
* `git config --global user.name "uw-naam"`
* `git config --global user.email "uw-email"`
Om te controleren of Git al is geconfigureerd, kunt u het volgende typen:
`git config --list`
U heeft ook een GitHub-account nodig, een code-editor (zoals Visual Studio Code) en u moet uw terminal openen (of: command prompt).
Navigeer naar [github.com](https://github.com/) en maak een account aan als u dat nog niet heeft gedaan, of log in en vul uw profiel in.
✅ GitHub is niet de enige coderepository ter wereld; er zijn anderen, maar GitHub is de bekendste
### Voorbereiding
U heeft zowel een map met een codeproject op uw lokale computer (laptop of pc) als een openbare repository op GitHub nodig, die als voorbeeld zal dienen voor hoe u kunt bijdragen aan de projecten van anderen.
---
## Code beheer
Laten we zeggen dat u lokaal een map hebt met een of ander codeproject en u wilt beginnen met het volgen van uw voortgang met git - het versiebeheersysteem. Sommige mensen vergelijken het gebruik van git met het schrijven van een liefdesbrief aan uw toekomstige zelf. Als u uw commitberichten dagen of weken of maanden later leest, zult u u kunnen herinneren waarom u een beslissing heeft genomen, of een wijziging "terugdraaien" - dat wil zeggen, wanneer u goede "commitberichten" schrijft.
### Taak: maak een repository en leg code vast
1. **Maak een repository op GitHub**. Zoek op GitHub.com, in het tabblad repositories, of in de navigatiebalk rechtsboven, de knop **new repo**.
1. Geef uw repository (map) een naam
1. Selecteer **create repository**.
1. **Navigeer naar uw werkmap**. Schakel in uw terminal naar de map (ook bekend als de directory) die u wilt beginnen met volgen. Typ:
```bash
cd [naam van uw map]
```
1. **Initialiseer een git-repository**. In uw project, typ:
```bash
git init
```
1. **Controleer de status**. Om de status van uw repository te controleren, typ:
```bash
git status
```
de output kan er ongeveer zo uitzien:
```output
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: file.txt
modified: file2.txt
```
Typisch vertelt een `git status` commando u dingen zoals welke bestanden klaar zijn om _opgeslagen_ te worden naar de repo of bevat veranderingen die u misschien wilt behouden.
1. **Voeg alle bestanden toe voor tracking**
Dit wordt ook wel staging-bestanden/ bestanden toevoegen aan het staging-gebied genoemd.
```bash
git add .
```
Het `git add` plus `.` argument geeft aan dat al uw bestanden en wijzigingen voor tracking geselecteerd zijn.
1. **Voeg geselecteerde bestanden toe voor tracking**
```bash
git add [bestands- of mapnaam]
```
Dit helpt ons om alleen geselecteerde bestanden aan het staging-gebied toe te voegen als we niet alle bestanden tegelijk willen vastleggen.
1. **Unstage alle bestanden**
```bash
git reset
```
Dit commando helpt ons om alle bestanden tegelijk te unstagen.
1. **Unstage een bepaald bestand**
```bash
git reset [bestands- of mapnaam]
```
Dit commando helpt ons om alleen een bepaald bestand tegelijk te unstagen dat we niet willen opnemen voor de volgende commit.
1. **Uw werk voortzetten**. Op dit punt heeft u de bestanden toegevoegd aan een zogenaamd _staging-gebied_. Een plek waar Git uw bestanden bijhoudt. Om de wijziging permanent te maken, moet u de bestanden _commiten_. Om dit te doen maakt u een _commit_ aan met het `git commit` commando. Een _commit_ vertegenwoordigt een besparingspunt in de geschiedenis van uw repo. Typ het volgende om een _commit_ te maken:
```bash
git commit -m "eerste commit"
```
Dit commit al uw bestanden door het bericht "first commit" toe te voegen. Voor toekomstige commitberichten wilt u meer beschrijvend zijn in uw beschrijving om over te brengen wat voor soort wijziging u heeft aangebracht.
1. **Verbind uw lokale Git-repo met GitHub**. Een Git-repo is goed op uw computer, maar op een gegeven moment wilt u ergens een back-up van uw bestanden hebben en ook andere mensen uitnodigen om met u aan uw opslagplaats te werken. Een geweldige plek om dat te doen is GitHub. Onthoud dat we al een repo op GitHub hebben gemaakt, dus het enige dat we hoeven te doen, is onze lokale Git-repo verbinden met GitHub. Het commando `git remote add` zal precies dat doen. Typ de volgende commando:
> Let op: voordat u de opdracht typt, gaat u naar uw GitHub-repo-pagina om de repository-URL te vinden. U gebruikt het in het onderstaande commando. Vervang `repository_name` door uw GitHub-URL.
```bash
git remote add origin https://github.com/username/repository_name.git
```
Dit creëert een _remote_, of verbinding, genaamd "origin", wijzend naar de GitHub-repository die u eerder heeft gemaakt.
1. **Stuur lokale bestanden naar GitHub**. Tot nu toe heeft u een _verbinding_ gemaakt tussen de lokale repo en de GitHub-repo. Laten we deze bestanden naar GitHub sturen met het volgende commando `git push`, zoals zo:
```bash
git push -u origin main
```
Dit stuurt uw commits in uw "main" tak naar GitHub.
1. **Om meer wijzigingen toe te voegen**. Als u door wilt gaan met het aanbrengen van wijzigingen en ze naar GitHub wilt pushen, hoeft u alleen maar de volgende drie commando's te gebruiken:
```bash
git add .
git commit -m "typ hier uw commitbericht"
git push
```
> Tip, misschien wilt u ook een `.gitignore`-bestand adopteren om te voorkomen dat bestanden die u niet wilt volgen, verschijnen op GitHub - zoals dat notitiesbestand dat u opslaat in dezelfde map maar geen plaats heeft op een openbare repository. U kunt sjablonen voor `.gitignore` bestanden vinden op [.gitignore templates](https://github.com/github/gitignore).
#### Commit berichten
Een geweldige onderwerpregel voor een commitbericht van Git maakt de volgende zin compleet:
Indien toegepast, zal deze commit <uw onderwerpregel hier>
Gebruik voor het onderwerp de gebiedende wijs, tegenwoordige tijd: "verander" niet "veranderd" noch "veranderingen".
Net als in het onderwerp, gebruik in het lichaam (optioneel) ook de imperatieve tegenwoordige tijd. Het lichaam moet de motivatie voor de verandering opnemen en dit contrasteren met eerder gedrag. U legt het `waarom` uit, niet het `hoe`.
✅ Neem een paar minuten de tijd om rond GitHub te surfen. Kunt u een echt geweldig commitbericht vinden? Kunt u een echt minimale vinden? Welke informatie is volgens u het belangrijkst en nuttigst om over te brengen in een commitbericht?
### Taak: Samenwerken
De belangrijkste reden om dingen op GitHub te zetten, was om het mogelijk te maken om samen te werken met andere ontwikkelaars.
## Samen met anderen aan projecten werken
Navigeer in uw repository naar `Insights > Community` om te zien hoe uw project zich verhoudt tot aanbevolen communitystandaarden.
Hier zijn enkele dingen die uw GitHub-repo kunnen verbeteren:
- **Omschrijving**. Heeft u een beschrijving voor uw project toegevoegd?
- **README**. Heeft u een README toegevoegd? GitHub biedt richtlijnen voor het schrijven van een [README](https://docs.github.com/articles/about-readmes/).
- **Richtlijn voor bijdragen**. Heeft uw project [richtlijnen voor bijdragen](https://docs.github.com/articles/setting-guidelines-for-repository-contributors/),
- **Gedragscode**. Een [Gedragscode](https://docs.github.com/articles/adding-a-code-of-conduct-to-your-project/),
- **Licentie**. Misschien nog belangrijker, een [licentie](https://docs.github.com/articles/adding-a-license-to-a-repository/)?
Al deze middelen zullen nieuwe teamleden helpen. En dat zijn typisch het soort dingen waar nieuwe bijdragers naar kijken voordat ze zelfs maar naar uw code kijken, om erachter te komen of uw project de juiste plek is om hun tijd door te brengen.
✅ README-bestanden, hoewel ze wat tijd nodig hebben om voor te bereiden, worden vaak genegeerd door drukke beheerders. Kunt u een voorbeeld vinden van een bijzonder beschrijvende? Opmerking: er zijn enkele [tools om goede README's te maken](https://www.makeareadme.com/) die u misschien zou willen proberen.
### Taak: voeg een code samen
Documenten voor bijdragen helpen mensen bij te dragen aan het project. Het legt uit wat voor soort bijdragen u zoekt en hoe het proces werkt. Bijdragers moeten een reeks stappen doorlopen om bij te dragen aan uw repo op GitHub:
1. **Uw repo forken** Waarschijnlijk wilt u dat mensen uw project _forken_. Forken betekent het maken van een replica van uw repository op hun GitHub-profiel.
1. **Kloon**. Van daaruit zullen ze het project naar hun lokale computer klonen (clone).
1. **Maak een tak**. U zult ze willen vragen om een _tak_ voor hun werk te creëren (branch).
1. **Richt hun verandering op één gebied**. Vraag bijdragers om hun bijdragen op één ding tegelijk te concentreren - op die manier is de kans groter dat u hun werk kan _samenvoegen_ (merge). Stelt u voor dat ze een bugfix schrijven, een nieuwe functie toevoegen en verschillende tests bijwerken - wat als u slechts 2 van de 3 of 1 van de 3 wijzigingen wilt of kunt implementeren?
✅ Stelt u een situatie voor waarin takken bijzonder cruciaal zijn voor het schrijven en verzenden van goede code. Welke use-cases kunt u bedenken?
> Let op: wees de verandering die u in de wereld wilt zien, en maak ook takken voor uw eigen werk. Alle commits die u maakt, worden gemaakt op de tak waar u momenteel naar "uitgecheckt" bent. Gebruik `git status` om te zien welke tak dat is.
Laten we een workflow voor bijdragers doorlopen. Veronderstel dat de bijdrager de repo al _geforkt_ en _gekloond_ heeft, zodat ze een Git-repo hebben klaar om aan te werken, op hun lokale computer:
1. **Maak een tak**. Gebruik het commando `git branch` om een branch te maken die de wijzigingen bevat die ze willen bijdragen:
```bash
git branch [taknaam]
```
1. **Overschakelen naar werkende tak**. Schakel over naar de gespecificeerde tak en update de werkdirectory met `git checkout`:
```bash
git checkout [taknaam]
```
1. **Werken**. Op dit punt wilt u uw wijzigingen toevoegen. Vergeet niet om Git erover te vertellen met de volgende commando's:
```bash
git add .
git commit -m "mijn veranderingen"
```
Zorg ervoor dat u uw commit een goede naam geeft, zowel voor u als voor de beheerder van de repo waarmee u helpt.
1. **Combineer uw werk met de `main` tak**. Op een gegeven moment bent u klaar met werken en wilt u uw werk combineren met dat van de `main` tak. De `main` tak kan ondertussen veranderd zijn, dus zorg ervoor dat u deze eerst bijwerkt naar de laatste versie met de volgende commando's:
```bash
git checkout main
git pull
```
Op dit punt wilt u er zeker van zijn dat alle _conflicten_, situaties waarin Git niet gemakkelijk de veranderingen kan _combineren_ plaatsvinden in uw werkende tak. Voer daarom de volgende opdrachten uit:
```bash
git checkout [taknaam]
git merge main
```
Dit brengt alle wijzigingen van `main` naar uw tak en hopelijk kunt u gewoon doorgaan. Als dit niet het geval is, zal VS Code u vertellen waar Git _in de war_ is en verandert u gewoon de betrokken bestanden om te zeggen welke inhoud het meest accuraat is.
1. **Stuur uw werk naar GitHub**. Het verzenden van uw werk naar GitHub betekent twee dingen. Uw tak naar uw repo pushen en vervolgens een PR, Pull Request openen.
```bash
git push --set-upstream origin [taknaam]
```
Het bovenstaande commando maakt de tak op uw geforkte repo.
1. **Open een PR**. Vervolgens wilt u een PR openen. U doet dat door naar de geforkte repo op GitHub te navigeren. U ziet een indicatie op GitHub waar het vraagt of u een nieuwe PR wilt maken, u klikt erop en u wordt naar een interface geleid waar u de titel van het commitbericht kunt wijzigen, geef het een meer geschikte beschrijving. Nu zal de beheerder van de repo die u heeft geforkt deze PR zien en, _vingers gekruist_, zullen ze uw PR waarderen en _samenvoegen_. U bent nu een bijdrager, yay :)
1. **Opruimen**. Het wordt als een goede gewoonte beschouwd om _op te ruimen_ nadat u met succes een PR hebt samengevoegd. U wilt zowel uw lokale tak opruimen als de tak die u naar GitHub hebt gepusht. Laten we het eerst lokaal verwijderen met het volgende commando:
```bash
git branch -d [taknaam]
```
Zorg ervoor dat u naar de GitHub-pagina gaat voor de geforkte repo en verwijder de externe tak die u er zojuist naartoe hebt gepusht.
`Pull request` lijkt een gekke term, omdat u uw wijzigingen echt in het project wilt pushen. Maar de onderhouder (projecteigenaar) of het kernteam moet rekening houden met uw wijzigingen voordat u deze samenvoegt met de "main" tak van het project, dus u vraagt echt om een wijzigingsbesluit van een onderhouder.
Een pull request is de plek om de verschillen die op een tak zijn geïntroduceerd te vergelijken en te bespreken met recensies, opmerkingen, geïntegreerde tests en meer. Een goed pull request volgt ongeveer dezelfde regels als een commitbericht. U kunt een verwijzing naar een probleem (issue) toevoegen in de issue tracker, bijvoorbeeld wanneer uw werk een probleem oplost. Dit doet u met een `#` gevolgd door het nummer van uw probleem. Bijvoorbeeld `# 97`.
🤞Duimen dat alle controles slagen en de projecteigenaar(s) uw wijzigingen in het project samenvoegen🤞
Update uw huidige lokale werkende tak met alle nieuwe commits van de corresponderende remote tak op GitHub:
`git pull`
## Hoe u kunt bijdragen aan open source
Laten we eerst een repository - of: repo - op GitHub zoeken die voor u interessant is en waaraan u een wijziging zou willen bijdragen. U zult de inhoud ervan naar uw machine kopiëren.
✅ Een goede manier om 'beginnersvriendelijke' repos te vinden, is door [te zoeken op de tag 'good-first-issue'](https://github.blog/2020-01-22-browse-good-first-issues-to-start-contributing-to-open-source/).
![Kopieer lokaal een repo](../images/clone_repo.png)
Er zijn verschillende manieren om code te kopiëren. Een manier is om de inhoud van de repository te "klonen" door HTTPS, SSH of de GitHub CLI (Command Line Interface) te gebruiken.
Open uw terminal en kloon de repository op deze manier:
`git clone https://github.com/ProjectURL`
Schakel naar de juiste map om aan het project te werken:
`cd ProjectURL`
U kunt ook het hele project openen met [Codespaces](https://github.com/features/codespaces), GitHub's ingesloten code-editor /cloud-ontwikkelomgeving of [GitHub Desktop](https://desktop.github.com/).
Ten slotte kunt u de code downloaden in een gecomprimeerde map.
### Nog een paar interessante dingen over GitHub
U kunt elke openbare repository op GitHub een ster geven, bekijken en/of "forken". U kunt uw repositories met ster vinden in het vervolgkeuzemenu rechtsboven. Het is net als bladwijzers, maar dan voor code.
Projecten hebben een issue tracker, meestal op GitHub in de "Issues" tab, tenzij anders aangegeven, waar mensen problemen bespreken die verband houden met het project. En op het tabblad Pull Requests bespreken en beoordelen mensen lopende wijzigingen.
Projecten kunnen ook worden besproken in forums, mailinglijsten of chatkanalen zoals Slack, Discord of IRC.
✅ Kijk eens rond in uw nieuwe GitHub-repo en probeer een paar dingen, zoals het bewerken van instellingen, het toevoegen van informatie aan uw repo en het maken van een project (zoals een Kanban-bord). U kunt veel doen!
---
## 🚀 Uitdaging
Koppel met een vriend om aan elkaars code te werken. Creëer gezamenlijk een project, fork code, maak takken en voeg wijzigingen samen.
## Quiz na de lezing
[Quiz na de lezing](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/4)
## Beoordeling en zelfstudie
Lees meer over [bijdragen aan open source software](https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution).
[Git-cheatsheet](https://training.github.com/downloads/github-git-cheat-sheet/).
Oefenen, oefenen, oefenen. GitHub heeft geweldige leertrajecten beschikbaar via [lab.github.com](https://lab.github.com/):
- [Eerste week op GitHub](https://lab.github.com/githubtraining/first-week-on-github)
U zult ook meer geavanceerde labs vinden.
## Toewijzing
Voltooi [de eerste week op GitHub-trainingslaboratorium](https://lab.github.com/githubtraining/first-week-on-github)

@ -0,0 +1,318 @@
# GitHub 介绍
这节课涵盖了 GitHub 的基础知识,这是一个可以用来存放代码和管理代码变更的平台。
![Intro to GitHub](/sketchnotes/webdev101-github.png)
> 涂鸦笔记作者:[Tomomi Imura](https://twitter.com/girlie_mac)
## 课前小测
[课前小测](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/3?loc=zh_cn)
## 大纲
这节课我们将会介绍:
- 在你的电脑上追踪你的工作
- 与他人协同开发项目
- 如何参与开源软件贡献
### 开始之前
开始之前,你需要确保安装了 Git在终端译注即上一节课中介绍的命令行中输入
`git --version`
如果没有安装 Git请先[下载并安装 Git](https://git-scm.com/downloads)。然后用如下命令设置你的本地 Git 使用者配置文件:
* `git config --global user.name "your-name"`
* `git config --global user.email "your-email"`
要检查 Git 使用者是否配置完成,可以输入:
`git config --list`
你还需要一个 GitHub 账户,一个代码编辑器(比如 Visual Studio Code并且要打开你的终端或者其他命令行
如果你没有现成的 Github 账号,去 [github.com](https://github.com/) 创建一个。如果已经有账号,就登录进去并且完成个人资料的配置。
✅ GitHub 并不是世界上唯一的代码仓库,但是最知名的。
### 课前准备
你需要在本地(你的笔记本或 PC创建一个项目文件夹还需要在 GitHub 上创建一个公开的仓库(译注:后文会有指引),作为本节课中向其他人的项目提贡献的示例。
---
## 代码管理
假如你在本地有一个代码项目的文件夹,你希望开始使用 Git (版本控制系统)来追踪你的进度。有的人将使用 Git 比作给未来的你自己写一封情书在数日、数周乃至数月后阅读你的提交信息commit messages你就可以想起你做出某个决定的原因或者回滚rollback一次变更 —— 前提是你写了不错的提交信息。
### 任务:创建仓库并提交代码
1. **在 GitHub 上创建仓库**。进入 GitHub.com在 “Repositories” 标签或者右上角导航栏找到 **New repository** 按钮。
1. 给你的仓库取个名字;
1. 点击 **Create repository**
1. **前往你的工作目录**。在你的终端中,通过输入下方命令切换到你希望开始追踪的文件夹(即目录):
```bash
cd [文件名称/目录路径]
```
1. **初始化一个 Git 仓库**。在你的项目下输入:
```bash
git init
```
1. **检查状态**。要检查你的仓库状态,输入:
```bash
git status
```
输出看起来将会像这样:
```output
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: file.txt
modified: file2.txt
```
一般来说 `git status` 命令会告诉你诸如什么文件已经 _被保存到_ 仓库内或者有一些你可能想要保留的变更之类的事。
1. **追踪所有文件**
这个操作也叫做暂存stage文件或者将文件添加到暂存区staging area
```bash
git add .
```
`git add` 命令加上 `.` 参数将会追踪你的所有文件和变更。
1. **只追踪选定的文件**
```bash
git add [文件或文件夹名]
```
如果你不想一次性将所有文件添加到暂存区,可以用这个命令仅仅添加选定的文件。
1. **取消所有文件的追踪**
```bash
git reset
```
这条命令可以帮我们取消暂存unstage所有文件。
1. **取消特定文件的追踪**
```bash
git reset [文件或文件夹名]
```
如果你在下次提交中不希望提交某个已经暂存的文件,可以用这条命令取消它的暂存。
1. **保存你的工作**。现在你应该已经将文件添加到了所谓 _暂存区_ 中,这是 Git 追踪你的文件的地方。为了永久地保存变更,你需要 _提交commit_ 这些文件。你可以用 `git commit` 命令创建一次 _提交_。一次 _提交_ 代表你的仓库历史中的一个存档点。输入下方命令来创建一次 _提交_
```bash
git commit -m "first commit"
```
这会提交你暂存区中的所有文件,并带上一条提交信息 —— “first commit”。在以后的提交信息中你会想要加入更加准确的描述比如一些表示你这次变更的类型的信息。
1. **将你的本地仓库连接到 GitHub**。现在 Git 仓库已经能在你的本地机器上正常运作但是有时候你会想要将你的文件备份到别处或者希望邀请其他人来一起参与这个仓库的协作。GitHub 就是一个可以满足你要求的好地方。我们此前已经在 GitHub 上创建了一个仓库,现在只需要将本地 Git 仓库连接到 GitHub 就可以了,用 `git remote add` 命令就可以做到。输入下面的命令:
> 注意,在你输入命令前,需要前往你的 GitHub 仓库而页面来找到仓库的地址URL用它来替换命令中 `username/repository_name` 这一部分。
```bash
git remote add origin https://github.com/username/repository_name.git
```
这会创建一个被命名为 “origin” 的 _远程仓库位置remote_,也可以理解为一个连接,指向你早先创建的 GitHub 仓库。
1. **将本地文件上传至 GitHub**。现在你已经创建了一个本地仓库和 GitHub 仓库间的 _连接_。让我们通过 `git push` 命令将这些文件上传至 GitHub就像这样
```bash
git push -u origin main
```
这样就会把你的提交上传到 GitHub 上你的 “main” 分支了。
1. **添加更多的变更**。如果你想继续搞点变更并且将它们传到 GitHub 上,你只需要使用下面的三行命令:
```bash
git add .
git commit -m "在这里填写你的提交信息"
git push
```
> 提示,你可能还需要建立一个 `.gitignore` 文件来防止 Git 追踪一些文件并且让它们不会被上传到 GitHub比如一些你写在本地仓库但并不想放到公开仓库的笔记文件。你可以在 [.gitignore templates](https://github.com/github/gitignore) 找到一些现成的 `.gitignore` 文件模板。
#### 提交信息Commit Messages
一条好的 Git 提交信息标题subject line可以理解为下方句子的填空
如果生效,这次提交将会 <你的提交信息标题>
在标题内,使用祈使语气和现在时态,即使用 “change” 而非 “changed” 或 “changes”。
同理在正文body可选中也要用祈使语气和现在时态。正文中需要包括更改的动机并对比与更改前后行为的变化。确保你说明的是`为什么`,而不是`怎么做`。
✅ 花几分钟逛逛 GitHub。你能找到感觉非常棒的提交信息吗你可以找到非常简洁的提交信息吗你认为在一条提交信息中传达什么信息是最重要和有用的
### 任务:协作
将项目放到 GitHub 的主要原因是让和其他开发者协作开发成为可能。
## 和其他人协作开发项目
在你的仓库中,前往 `Insights > Community` 来查看你的项目和推荐的社区规范的对比。
这里有一些你可以改进你的项目仓库的点:
- **项目描述Description**。你为你的项目添加了描述吗?
- **README**。你有添加 README 吗GitHub 提供了撰写 [README](https://docs.github.com/articles/about-readmes/) 的指南。
- **贡献指南Contributing guideline**。你的项目是否有[贡献指南](https://docs.github.com/articles/setting-guidelines-for-repository-contributors/)
- **行为准则Code of Conduct**。添加一份 [行为准则](https://docs.github.com/articles/adding-a-code-of-conduct-to-your-project/)
- **开源协议License**。或许是最重要的,添加一个[开源协议](https://docs.github.com/articles/adding-a-license-to-a-repository/)
所有这些资源对于新加入的团队成员都是很有好处的,这些一般是新的贡献者在看你的代码前会更先去看的东西,以确认你的项目是否值得他们在这上面花费时间。
✅ 尽管很多人都准备了 README 文件,但常常会因为太忙而疏于维护。你能找到一个这样的例子吗?注:这里有一些可以[用于创建优秀的 README 的工具](https://www.makeareadme.com/),你或许愿意试试。
### 任务合并Merge一些代码
贡献文档帮助人们对项目做贡献,其中说明了你正需要什么样的贡献以及贡献的过程该是怎样的。贡献者需要完成一系列步骤才能在 GitHub 上参与你项目的贡献:
1. **复刻Fork你的仓库**。你可能希望人们 _复刻_ 你的项目。复刻意味着在他们自己的 GitHub 账户下创建你的项目的一份副本。
1. **克隆Clone**。在这里他们将会将项目克隆到他们的本地机器上。
1. **创建一个分支Branch**。你可能希望他们能创建一个 _分支_ 来进行他们的工作。
1. **集中进行一个区域的修改**。要求贡献者每次贡献只专注做一件事,这样你才更可能 _合并_ 他们的工作。想象一下如果他们修了一个 BUG添加了一个新特性然后更新了几个测试而你其实只想要其中的一个或两个更改时该怎么办
✅ 想一想分支在什么情况下对于编写和发布优质的代码非常重要?你能想到哪些使用实例?
> 注意要以身作则对你自己的工作也要创建分支。任何提交都需要在当前“检出checked out”的分支上进行。使用 `git status` 来查看是哪一个分支。
让我们走一遍贡献者的工作流程。假设贡献者已经 _复刻__克隆_ 了仓库,他们在本地机器已经有了一个可以工作的仓库:
1. **创建一个分支**。使用命令 `git branch` 来创建一个他们希望用来包含计划进行的变更的分支:
```bash
git branch [分支名]
```
1. **切换到工作分支**。使用 `git checkout` 来切换到指定分支并且更新工作目录中的文件:
```bash
git checkout [分支名]
```
1. **干活**。现在你可以添加你的变更了,别忘了用下面的命令告诉 Git 你所做的工作:
```bash
git add .
git commit -m "变更内容"
```
确保你的提交有一个好名字,不论是对你自己还是你正在帮助的仓库维护者来说都有好处。
1. **将你的工作合入 `main` 分支**。在完成工作后,你打算将你的工作和 `main` 分支上的合并。`main` 分支可能同时有了一些新的变更,所以要先用以下命令确保将其更新至最新版本:
```bash
git checkout main
git pull
```
这时你想确认是否存在 _冲突conflicts_,即 Git 没法简单地将这些变化 _合入_ 你的分支的情况。为此运行下面的命令:
```bash
git checkout [分支名]
git merge main
```
这将会把所有 `main` 分支上的变更带入到你的分支上。运气好的话一切都会自动搞定,否则 VS Code 会告诉你哪些文件 Git _不确定_ 该如何合并,你只需要手动修改对应文件来解决冲突即可。
1. **将你的工作上传至 GitHub**。将你的工作上传至 GitHub 意味着两件事:把你的分支上传到你自己的仓库,然后开启一个 PRPull Request
```bash
git push --set-upstream origin [分支名]
```
上述命令在你复刻的仓库中创建了一个分支。
1. **开启一个 PR**。接下来,你打算开启一个 PR。前往 GitHub 上你打算贡献的仓库,你将会看到一个消息条询问你是否想要创建一个新的 PR点击后即可进入创建 PR 的界面。在这里你可以更改提交标题,给出更准确的描述。创建 PR 后,仓库维护者将会看到这个,如果 _一切顺利_ 的话他们会表示感谢并且 _合并_ 你的 PR。你现在就是一位贡献者啦 :)
1. **清理**。成功合入一个 PR 后,做做 _清理_ 是一个好习惯。你会想要清理本地和你上传到 GitHub 的分支。首先让我们通过下面的命令来删除本地的分支:
```bash
git branch -d [分支名]
```
接下来请确保前往 GitHub 中对应仓库的页面并删除你刚才上传的分支。
`Pull request` 这个术语看起来有些憨,因为你确实打算把你的变更提交到这个项目中。但是在将你的变更合入到项目的 `main` 分支前维护者项目拥有者或者核心团队需要考虑和检查你的变更这意味着你实际上是在请求request维护者的变更决定。
Pull Request 是一个可以用来比较和讨论一个分支引入的改动的地方,并有代码审查、评论、集成测试等功能。优质的 Pull Request 严格遵照与提交信息相同的规则。如果你的工作是为了修复一个 Issues 面板中的事项,你可以在 PR 中提及这个事项。具体做法是写一个 `#` 加上事项的编号,比如 `#97`
🤞如果一切顺利,所有的检查都通过后项目拥有者就会将你的变更合入项目🤞
使用这个命令即可将 GitHub 上对应远程分支的所有新提交更新到当前本地的工作分支上:
`git pull`
## 如何参与开源贡献
首先,让我们在 GitHub 上找到一个你感兴趣且愿意参与贡献的仓库(**repo**),你会复制一份它的内容到你的机器上。
✅ 一个寻找对入门者友好的仓库的好办法是[搜索 “good-first-issue” 标签](https://github.blog/2020-01-22-browse-good-first-issues-to-start-contributing-to-open-source/)。
![Copy a repo locally](../images/clone_repo.png)
有很多种复制代码的方法,其中一种就是“克隆”仓库的内容,可以用 HTTPS、SSH 或者 GitHub CLICommand Line Interface来做到。
打开你的终端并且用类似下方的命令来克隆仓库:
`git clone https://github.com/ProjectURL`
切换到正确的工作目录:
`cd ProjectURL`
你也可以用 [Codespaces](https://github.com/features/codespaces) 来打开整个项目,这是 GitHub 内置的代码编辑器和云开发环境,或者用 [GitHub Desktop](https://desktop.github.com/)。
当然,你也可以直接下载代码的压缩包。
### 更多 GitHub 的有趣小知识
你可以收藏star、关注watch和/或复刻forkGitHub 上的任何公开仓库。可以在右上角的下拉菜单找到你收藏的仓库,这就像书签一样,但收藏的是代码。
项目都有一个事项面板issue tracker用于让人们讨论和这个项目相关的事项事项面板基本都在 GitHub 的 “Issues” 标签页中,偶尔也会指明在其他地方。而 “Pull Requests” 标签页则是人们讨论和检查正在进行的变更的地方。
项目也可能会在论坛、邮件列表或者如 Slack、Discord、IRC 这样的聊天频道进行讨论。
✅ 看看你新建立的 GitHub 仓库,尝试做一些其他事,比如编辑设置、为仓库增加信息、创建一个 Project类似看板有很多可以尝试的东西
---
## 🚀 挑战
找朋友一起编辑彼此的代码。协作创建一个项目、复刻代码、创建分支,然后合并变更。
## 课后小测
[课后小测](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/4?loc=zh_cn)
## 复习 & 自学
了解更多 [如何提交贡献](https://opensource.guide/zh-hans/how-to-contribute/#%E5%A6%82%E4%BD%95%E6%8F%90%E4%BA%A4%E8%B4%A1%E7%8C%AE)。
[Git cheatsheet](https://training.github.com/downloads/github-git-cheat-sheet/)。
练习练习再练习。GitHub 在 [lab.github.com](https://lab.github.com/) 提供了很棒的学习路径:
- [在 GitHub 的第一周](https://lab.github.com/githubtraining/first-week-on-github)
你还可以在上面找到更多高阶的实验内容。
## 作业
完成 [在 GitHub 的第一周](https://lab.github.com/githubtraining/first-week-on-github)

@ -0,0 +1,319 @@
# GitHub 簡介
這堂課程講述一個提供加設與管理程式碼的平台 ── Github的基本功能。
![GitHub 簡介](/sketchnotes/webdev101-github.png)
> 由[Tomomi Imura](https://twitter.com/girlie_mac) 繪製
## 課前測驗
[課前測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/3?loc=zh_tw)
## 大綱
在這堂課中,包含:
- 追蹤裝置上的工作專案
- 與其他人共同開發專案
- 如何貢獻網路上的開源軟體
### 開始之前
在你開始課程之前,你需要安裝 Git 這套套件。在你的終端機上輸入:
`git --version`
若你的裝置上沒有安裝 Git[請下載並安裝 Git](https://git-scm.com/downloads)。 安裝完之後,請設定裝置本地 Git 的使用者設定。
* `git config --global user.name "your-name"`
* `git config --global user.email "your-email"`
要確認 Git 使用者設定是否完成,你可以輸入:
`git config --list`
此外,你需要一組 GitHub 的帳戶、一款文字編輯器 (如Visual Studio Code) 與你的終端機 (或 command prompt)。
若你缺少 GitHub 帳戶,請前往 [github.com](https://github.com/)建立並登入一組帳戶,遵循指示完成資料的填寫。
✅ GitHub 不是唯一的程式碼數據庫,但 GitHub 是家喻戶曉的。
### 課前準備
你需要在裝置(筆電或電腦)上建立程式專案的資料夾,與 GitHub 公共的數據庫(Public Repository)。之後的例子會使用到此公共數據庫來與他人分享程式碼。
---
## 程式碼管理
假設你的本地端資料夾存放著一些程式專案,你想利用 Git 來作專案追蹤與版本控制,甚至是對未來的你寫一封情書。在一天、一週甚至是一個月後閱讀你的提交紀錄,了解當初你的決定,回想之前的更動。前提是當初你有寫一條完整的提交紀錄。
### 課題:建立數據庫並提交程式碼
1. **在 GitHub 上建立數據庫** 在 GitHub.com 上,在 "Repositories" 的標籤或導航欄的右上方,找到 **new repo** 的按鈕。
1. 為你的數據庫資料夾取個名字。
1. 選擇 **建立數據庫(create repository)**.
1. **調查本地的專案資料夾** 在終端機中開啟儲存程式碼的資料夾,在你想追蹤的目錄下輸入:
```bash
cd [資料夾名稱]
```
1. **初始化 git 數據庫(repo)** 在目錄下輸入:
```bash
git init
```
1. **檢查狀態** 若想檢查目前數據庫的狀態,輸入:
```bash
git status
```
它會輸出類似以下的訊息:
```output
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: file.txt
modified: file2.txt
```
指令 `git status` 會回報那些檔案已經準備 _被存到_ 數據庫或是被更動過但不想更新上去。
1. **開始追蹤所有檔案**
新增檔案到暫存區(staging area)。
```bash
git add .
```
`git add` 加上路徑 `.` 表示追蹤該路徑下所有的檔案。
1. **只追蹤選擇的檔案**
```bash
git add [檔案或資料夾路徑]
```
上述指令幫助你只追蹤被選取的檔案,允許使用者分批提交。
1. **取消追蹤所有檔案**
```bash
git reset
```
上述指令能取消追蹤(unstage)暫存區的檔案。
1. **取消追蹤特定的檔案**
```bash
git reset [檔案或資料夾路徑]
```
上述指令只取消追蹤單一檔案,在下一次提交時不被圈選在裡面。
1. **保存工作狀態** 現在,已經有一些檔案被標記在 _暫存區(staging area)_。 Git 會追蹤區域內的檔案。若要保存這些檔案的狀態,你需要 _提交(commit)_ 這些檔案。 _提交_ 會記錄當下數據庫中檔案的狀態到歷史紀錄中。 你需要指令`git commit` 完成這項工作。
```bash
git commit -m "first commit"
```
這會提交暫存區內的檔案,"first commit"即提交紀錄。提交紀錄最好能識別出這次的提交主要做了那些更動。
1. **連接本地數據庫到 GitHub 遠端數據庫** 現在 Git 數據庫已經成功運行在你的本地裝置上,但有時候你希望能將檔案備份到其他地方,或是邀請他人參與這項程式專案。 GitHub 便是一個好地方。先前我們已經建立遠端數據庫在 GitHub 上,現在我們只要連接本地數據庫到 GitHub上。指令 `git remote add` 能完成這項課題:
> 注意,在輸入指令前,你需要取得 GitHub 遠端數據庫的 URL 位置。請將下列的 `repository_name` 替換為你的遠端數據庫路徑。
```bash
git remote add origin https://github.com/username/repository_name.git
```
這會在 GitHub 遠端數據庫上建立一個名叫 "origin" 的 _遠端位置(remote)_ ,或稱 _連接(connection)_
1. **上傳本地檔案到 GitHub** 現在已經建好了遠端與本地的 _連接_。 利用指令 `git push` 可以將本地檔案上傳到遠端數據庫當中:
```bash
git push -u origin main
```
所有的提交都會加到 GitHub 上 "main" 的分支當中。
1. **增加更多的更動** 若之後再對程式碼有所更動、提交並上傳到 GitHub 上,只要輸入:
```bash
git add .
git commit -m "type your commit message here"
git push
```
> 提示:建立 `.gitignore` 檔案可以讓你自動排除的特定檔案項目不被 GitHub 追蹤。好比是有一個在同一個目錄下的筆記檔不想被上傳到遠端數據庫。以下是 `.gitignore` 的參考版型: [.gitignore 參考版型](https://github.com/github/gitignore)。
#### 提交紀錄(Commit Messages)
一條好的 Git 提交標題行最好滿足下列條件:
提交完後,提交紀錄會顯示 <你的標題>
標題使用祈使語句,如使用 "change" 而非 "changed" 或 "changes"。
同理地,內文(選擇性)也使用祈使語句。內文須包含改動的動機與改動前後的差異。你需要解釋「為什麼改」而非「怎麼改」。
✅ 花點時間在 GitHub 上閒晃。你能找到很棒的提交紀錄嗎? 你能找到簡潔的提交紀錄嗎? 哪些資訊是你認為一個提交紀錄要有的重要資訊?
### 課題:多人合作
另一個將專案上傳到 GitHub 的主要原因是讓其他開發者能參與其中。
## 與其他人共同開發專案
在你的遠端資料庫中,前往 `Insights > Community` 來對比你的專案與其他推薦社群專案。
以下是一些你的 GitHub 數據庫需要精進的地方:
- **專案描述(Description)** 你有為你的專案新增描述嗎?
- **README** 你有新增 README 嗎? GitHub 提供編寫 README 的指引與參考: [README](https://docs.github.com/articles/about-readmes/)
- **開發指引(Contributing guideline)** 你的專案內有[開發指引](https://docs.github.com/articles/setting-guidelines-for-repository-contributors/)嗎?
- **行為準則(Code of Conduct)** [行為準則](https://docs.github.com/articles/adding-a-code-of-conduct-to-your-project/)
- **授權條款License** 這或許是最重要的:[授權條款](https://docs.github.com/articles/adding-a-license-to-a-repository/)
這些資源對剛加入到專案的新成員有所幫助。這些是新的合作夥伴比看程式碼還優先查詢的地方。完善它們能有效縮減他人消化的時間。
✅ README 檔,雖然多數人都會配置,但忙碌的開發者都會疏於管理。 你能在社群中找到相關的例子嗎? 這邊有[關於建立 READMEs 的有利工具](https://www.makeareadme.com/)可以嘗試。
### 課題:合併程式碼
開發指引文件幫助他人了解如何共同開發專案。它提供專案需要被貢獻的部分與該如何運作。共同開發者需要經過下列步驟來與他人在 GitHub 共同開發專案:
1. **分叉(Fork)專案** 你或許希望別人能 _分叉(fork)_ 你的專案。 分叉代表別人建立一份你的專案副本到他人的 GitHub 數據庫中。
1. **複製(Clone)** 複製專案到他人的本地裝置中。
1. **建立分支(branch)** 依照工作需求建立 _分支(branch)_
1. **專注在他人投入的工作範圍** 要求他人只專注在單一課題上,這樣能提升他們工作 _合併(merge)_ 的機會。想像他們在修正錯誤,同時又新增新功能、更新測試機制......這時如果你只想合併其中的一個、或者是兩個功能呢?
✅ 想像一個情況:一個重要的分支是編輯與分享的主軸,它能被如何應用?
> 注意,在做更動前,記得建立新的分支。任何提交都會在你所在的分支上,指令 `git status` 可以檢查你現在所在的分支。
現在,我們以共同開發者的角度來看。假設開發者已經 _分支__複製_ 了他人的數據庫到自己的 Git 數據庫上,準備開始編輯檔案:
1. **建立新的分支** 利用指令 `git branch` 來建立新的分支,只做相關的工作改動。
```bash
git branch [分支名稱]
```
1. **切換到該工作分支** 使用指令 `git checkout` 來切換到特定分支,更新分支的檔案狀態:
```bash
git checkout [分支名稱]
```
1. **程式設計** 記得追蹤你所更改的地方,利用下列的指令來告訴 Git
```bash
git add .
git commit -m "my changes"
```
請確保提交都有適當的名稱,對管理者與你自己都有好處。
1. **將工作分支與 `main` 分支進行合併** 當工作完成時,你會需要將工作分支與 `main` 分支進行合併。 `main` 分支可能會被他人更新,在合併之前記得更新主分支:
```bash
git checkout main
git pull
```
這項步驟可能會面臨到 _衝突(conflicts)_,代表 Git 無法將本地的更動作 _合併(combine)_ 。此時你需要執行下列的指令:
```bash
git checkout [分支名稱]
git merge main
```
這會將所有 `main` 分支的改動加入到你的本地目錄中。若出現狀況VS Code會告訴你 Git 會對衝突的檔案感到 _困惑(confused)_ 你需要判斷哪一項檔案或程式碼才是最適當的選擇。
1. **將你的成果上傳到 GitHub** 這代表著兩件事:將分支推到你的遠端數據庫以及準備建立 Pull Request(PR)。
```bash
git push --set-upstream origin [分支名稱]
```
上述的指令會在分叉的數據庫中新增分支。
1. **建立 PR** 藉由造訪分叉的數據庫中建立 PRGitHub 會指示你是否要建立 PR之後要填寫提交紀錄以及編寫詳細的說明。讓管理者了解你做了哪些更動並進行 _交叉比對(fingers crossed)_。 他們會感激你的貢獻並 _合併(merge)_ 你的 PR。完成這步後你就成為了專案貢獻者恭喜
1. **清理專案** 在 PR 被成功合併後, _清除專案(clean up)_ 會是一個好習慣。 你需要清除你的本地分支以及你的遠端數據庫分支。首先,你可以利用下列的指令清除本地分支:
```bash
git branch -d [分支名稱]
```
之後,請確保在 GitHub 頁面上刪除遠端分支。
`Pull request` 要求更新更動到「自己」的專案數據庫,這看起來很蠢。但管理者與核心組員必須謹慎地考量你的更動才能合併到專案的主分支中。這便是向管理者請求上傳許可。
一個 PR 提供比對以及討論的地方,解釋分支的意義、確認程式的合理性、留言與測試……等等。一個好的 PR 必須參照前述所說的提交紀錄準則。若你的 PR 有解決特定的 issue記得標記在 PR 當中。使用 `#` 接在數字前面來標記 issue 編號,如 `#97`
🤞 交叉比對每個程式環節都正確無誤後,專案管理者才合併你所作的更動 🤞
若要從 GitHub 遠端數據庫更新到目前的本地工作分支,使用:
`git pull`
## 如何貢獻網路上的開源軟體
首先,尋找一個你感興趣的數據庫,你會複製一份副本到自己的裝置上。
✅ 對新手而言,尋找「適合新手」的數據庫可以[搜尋 'good-first-issue' 標籤](https://github.blog/2020-01-22-browse-good-first-issues-to-start-contributing-to-open-source/)。
![複製數據庫到本地](../images/clone_repo.png)
有許多方式來複製數據庫。 一種是利用 "clone" 整個數據庫的內容。可以使用 HTTPS、SSH 或是 GitHub CLI (Command Line Interface)。
打開終端機並輸入下列指令來複製數據庫:
`git clone https://github.com/ProjectURL`
複製完後記得切換到正確的資料夾當中:
`cd ProjectURL`
你也可以利用[Codespaces](https://github.com/features/codespaces)來打開專案,一款嵌入在 GitHub 中的雲端開發環境,或是使用[GitHub Desktop](https://desktop.github.com/)。
最後,你也可以下載數據庫的壓縮檔。
### 有關 GitHub 的小知識
你可以為別人打星星(star)、追蹤(watch)或分叉(fork)任何一個 GitHub 上的共享數據庫。打上星星的數據庫會出現在右上方的導航欄中。就像是書籤,但是是給程式碼用的。
專案內會有 issue 追蹤器。大多數的 issue 會在 GitHub "Issue" 的標籤內(有些Issue會由作者另外說明),供大家進行討論。 Pull Requests 標籤內會有正在討論與審核的程式更動。
專案也會有討論區、寄信功能以及聊天室如 Slack、Discord 或 IRC。
✅ 花點時間觀察你的新專案,試著更新設定、新增描述、或架構成一個大型專案(像個大看板一樣!)。你可以創造出任何東西!
---
## 🚀 挑戰
找朋友一起編輯彼此的程式。共同建立一項專案、分叉程式、建立分支、合併更動。
## 課後測驗
[課後測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/4?loc=zh_tw)
## 複習與自學
了解更多:
[貢獻開源軟體](https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution)
[Git cheatsheet](https://training.github.com/downloads/github-git-cheat-sheet/)
練習,練習,再練習! GitHub 有提供很好的學習管道:[lab.github.com](https://lab.github.com/)
- [第一週在 GitHub 上](https://lab.github.com/githubtraining/first-week-on-github)
你能找到更資深的實驗內容。
## 作業
完成[第一週在 GitHub 上](https://lab.github.com/githubtraining/first-week-on-github)

@ -1,6 +1,6 @@
# Creating Accessible Webpages
![All About Accessibility](webdev101-a11y.png)
![All About Accessibility](/sketchnotes/webdev101-a11y.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz
@ -24,15 +24,15 @@ At its most basic, a screen reader will read a page from top to bottom audibly.
Every web developer should familiarize themselves with a screen reader. As highlighted above, it's the client your users will utilize. Much in the same way you're familiar with how a browser operates, you should learn how a screen reader operates. Fortunately, screen readers are built into most operating systems.
Some browsers also have built-in tools and extensions that can read text aloud or even provide some basic navigational features, such as [these accessibility-focused Edge browser tools](https://support.microsoft.com/en-us/help/4000734/microsoft-edge-accessibility-features). These are also important accessibility tools, but function very differently from screen readers and they should not be mistaken for screen reader testing tools.
Some browsers also have built-in tools and extensions that can read text aloud or even provide some basic navigational features, such as [these accessibility-focused Edge browser tools](https://support.microsoft.com/help/4000734/microsoft-edge-accessibility-features). These are also important accessibility tools, but function very differently from screen readers and they should not be mistaken for screen reader testing tools.
✅ Try a screen reader and browser text reader. On Windows [Narrator](https://support.microsoft.com/en-us/windows/complete-guide-to-narrator-e4397a0d-ef4f-b386-d8ae-c172f109bdb1) is included by default, and [JAWS](https://webaim.org/articles/jaws/) and [NVDA](https://www.nvaccess.org/about-nvda/) can also be installed. On macOS and iOS, [VoiceOver](https://support.apple.com/guide/voiceover/welcome/10) is installed by default.
✅ Try a screen reader and browser text reader. On Windows [Narrator](https://support.microsoft.com/windows/complete-guide-to-narrator-e4397a0d-ef4f-b386-d8ae-c172f109bdb1) is included by default, and [JAWS](https://webaim.org/articles/jaws/) and [NVDA](https://www.nvaccess.org/about-nvda/) can also be installed. On macOS and iOS, [VoiceOver](https://support.apple.com/guide/voiceover/welcome/10) is installed by default.
### Zoom
Another tool commonly used by people with vision impairments is zooming. The most basic type of zooming is static zoom, controlled through `Control + plus sign (+)` or by decreasing screen resolution. This type of zoom causes the entire page to resize, so using [responsive design](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Responsive_Design) is important to provide a good user experience at increased zoom levels.
Another tool commonly used by people with vision impairments is zooming. The most basic type of zooming is static zoom, controlled through `Control + plus sign (+)` or by decreasing screen resolution. This type of zoom causes the entire page to resize, so using [responsive design](https://developer.mozilla.org/docs/Learn/CSS/CSS_layout/Responsive_Design) is important to provide a good user experience at increased zoom levels.
Another type of zoom relies on specialized software to magnify one area of the screen and pan, much like using a real magnifying glass. On Windows, [Magnifier](https://support.microsoft.com/en-us/windows/use-magnifier-to-make-things-on-the-screen-easier-to-see-414948ba-8b1c-d3bd-8615-0e5e32204198) is built in, and [ZoomText](https://www.freedomscientific.com/training/zoomtext/getting-started/) is a third-party magnification software with more features and a larger user base. Both macOS and iOS have a built-in magnification software called [Zoom](https://www.apple.com/accessibility/mac/vision/).
Another type of zoom relies on specialized software to magnify one area of the screen and pan, much like using a real magnifying glass. On Windows, [Magnifier](https://support.microsoft.com/windows/use-magnifier-to-make-things-on-the-screen-easier-to-see-414948ba-8b1c-d3bd-8615-0e5e32204198) is built in, and [ZoomText](https://www.freedomscientific.com/training/zoomtext/getting-started/) is a third-party magnification software with more features and a larger user base. Both macOS and iOS have a built-in magnification software called [Zoom](https://www.apple.com/accessibility/mac/vision/).
### Contrast checkers
@ -133,7 +133,7 @@ You can use `aria-label` to describe the link when the format of the page doesn'
<a href="#" aria-label="Widget description">description</a>
```
✅ In general, using Semantic markup as described above supersedes the use of ARIA, but sometimes there is no semantic equivalent for various HTML widgets. A good example is a Tree. There's no HTML equivalent for a tree, so you identify the generic `<div>` for this element with a proper role and aria values. The [MDN documentation on ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) contains more useful information.
✅ In general, using Semantic markup as described above supersedes the use of ARIA, but sometimes there is no semantic equivalent for various HTML widgets. A good example is a Tree. There's no HTML equivalent for a tree, so you identify the generic `<div>` for this element with a proper role and aria values. The [MDN documentation on ARIA](https://developer.mozilla.org/docs/Web/Accessibility/ARIA) contains more useful information.
```html
<h2 id="tree-label">File Viewer</h2>

@ -1,6 +1,6 @@
# Creación de páginas web accesibles
![Todo sobre accesibilidad](../webdev101-a11y.png)
![Todo sobre accesibilidad](/sketchnotes/webdev101-a11y.png)
> Sketchnote por [Tomomi Imura](https://twitter.com/girlie_mac)
## [Pre-lecture prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/5)
@ -9,7 +9,7 @@
>
> \- Sir Timothy Berners-Lee, director del W3C e inventor de la World Wide Web
Esta cita destaca perfectamente la importancia de crear sitios web accesibles. Una aplicación a la que no pueden acceder todos es, por definición, excluyente. Como desarrolladores web, siempre debemos tener en cuenta la accesibilidad. Al tener este enfoque desde el principio, estará bien encaminado para garantizar que todos puedan acceder a las páginas que crea. En esta lección, aprenderá sobre las herramientas que pueden ayudarlo a asegurarse de que sus activos web sean accesibles y cómo construir teniendo en cuenta la accesibilidad.
Esta cita destaca perfectamente la importancia de crear sitios web accesibles. Una aplicación a la que no pueden acceder todos es, por definición, excluyente. Como desarrolladores web, siempre debemos tener en cuenta la accesibilidad. Al tener este enfoque desde el principio, estará bien encaminado para garantizar que todos puedan acceder a las páginas que crea. En esta lección, aprenderás sobre las herramientas que pueden ayudarlo a asegurarse de que sus activos web sean accesibles y cómo construir teniendo en cuenta la accesibilidad.
## Herramientas para usar
@ -19,56 +19,56 @@ Una de las herramientas de accesibilidad más conocidas son los lectores de pant
[Lectores de pantalla](https://en.wikipedia.org/wiki/Screen_reader) son clientes de uso común para personas con problemas de visión. A medida que dedicamos tiempo a asegurarnos de que un navegador transmita correctamente la información que deseamos compartir, también debemos asegurarnos de que un lector de pantalla haga lo mismo.
En su forma más básica, un lector de pantalla leerá una página de arriba a abajo de forma audible. Si su página es todo texto, el lector transmitirá la información de manera similar a un navegador. Por supuesto, las páginas web rara vez son puramente texto; contendrán enlaces, gráficos, color y otros componentes visuales. Se debe tener cuidado para garantizar que un lector de pantalla lea correctamente esta información.
En su forma más básica, un lector de pantalla leerá una página de arriba a abajo de forma audible. Si la página es todo texto, el lector transmitirá la información de manera similar a un navegador. Por supuesto, las páginas web rara vez son puramente texto; contendrán enlaces, gráficos, color y otros componentes visuales. Se debe tener cuidado para garantizar que un lector de pantalla lea correctamente esta información.
Todo desarrollador web debería familiarizarse con un lector de pantalla. Como se destacó anteriormente, es el cliente que utilizarán sus usuarios. De la misma manera que está familiarizado con el funcionamiento de un navegador, debe aprender cómo funciona un lector de pantalla. Afortunadamente, los lectores de pantalla están integrados en la mayoría de los sistemas operativos y muchos navegadores contienen extensiones para emular un lector de pantalla.
Todo desarrollador web debería familiarizarse con un lector de pantalla. Como se destacó anteriormente, es el cliente que utilizarán sus usuarios. De la misma manera que estás familiarizado con el funcionamiento de un navegador, debes aprender cómo funciona un lector de pantalla. Afortunadamente, los lectores de pantalla están integrados en la mayoría de los sistemas operativos y muchos navegadores contienen extensiones para emular un lector de pantalla.
✅ Prueba una extensión o herramienta de navegador de lector de pantalla. Uno que solo funciona en Windows es [JAWS](https://webaim.org/articles/jaws/). Los navegadores también tienen herramientas integradas que se pueden utilizar para este propósito; Consulte estas [herramientas de navegador Edge centradas en la accesibilidad](https://support.microsoft.com/en-us/help/4000734/microsoft-edge-accessibility-features).
✅ Prueba una extensión o herramienta de navegador de lector de pantalla. Uno que solo funciona en Windows es [JAWS](https://webaim.org/articles/jaws/). Los navegadores también tienen herramientas integradas que se pueden utilizar para este propósito; Consulta estas [herramientas de navegador Edge centradas en accesibilidad](https://support.microsoft.com/help/4000734/microsoft-edge-accessibility-features).
### Damas de contraste
### Checar contrastes
Los colores en los sitios web deben elegirse cuidadosamente para responder a las necesidades de los usuarios daltónicos o de las personas que tienen dificultades para ver colores de bajo contraste.
✅ Pruebe un sitio web que le guste usar para el uso del color con una extensión de navegador como
[WCAG's color checker](https://microsoftedge.microsoft.com/addons/detail/wcag-color-contrast-check/idahaggnlnekelhgplklhfpchbfdmkjp?hl=en-US). ¿Qué aprendes?
✅ Prueba un sitio web que te guste usar para el uso del color con una extensión de navegador como
[WCAG's color checker](https://microsoftedge.microsoft.com/addons/detail/wcag-color-contrast-check/idahaggnlnekelhgplklhfpchbfdmkjp?hl=en-US). ¿Qué aprendiste?
### Lighthouse
En el área de herramientas para desarrolladores de su navegador, encontrará la herramienta Lighthouse. Esta herramienta es importante para obtener una primera visión de la accesibilidad (así como otros análisis) de un sitio web. Si bien es importante no depender exclusivamente de Lighthouse, una puntuación del 100% es muy útil como referencia.
En el área de herramientas para desarrolladores en tu navegador, encontrarás la herramienta Lighthouse. Esta herramienta es importante para obtener una primera visión de la accesibilidad (así como otros análisis) de un sitio web. Si bien es importante no depender exclusivamente de Lighthouse, una puntuación del 100% es muy útil como referencia.
✅ Busque Lighthouse en el panel de herramientas de desarrollo de su navegador y ejecute un análisis en cualquier sitio. ¿Qué descubres?
✅ Busca Lighthouse en el panel de herramientas de desarrollo de su navegador y ejecuta un análisis en cualquier sitio. ¿Qué descubres?
## Diseñar para la accesibilidad
La accesibilidad es un tema relativamente extenso. Para ayudarlo, existen numerosos recursos disponibles.
La accesibilidad es un tema relativamente extenso. Para ayudarte, existen numerosos recursos disponibles.
- [Accessible U - University of Minnesota](https://accessibility.umn.edu/your-role/web-developers)
Si bien no podremos cubrir todos los aspectos de la creación de sitios accesibles, a continuación se muestran algunos de los principios básicos que querrá implementar. Diseñar una página accesible desde el principio es ** siempre ** más fácil que volver a una página existente para hacerla accesible.
Si bien no podremos cubrir todos los aspectos de la creación de sitios accesibles, a continuación se muestran algunos de los principios básicos que querrá implementar. Diseñar una página accesible desde el principio es **siempre** más fácil que volver a una página existente para hacerla accesible.
## Buenos principios de visualización
### Paletas de colores seguros
La gente ve el mundo de diferentes formas, y esto incluye los colores. Al seleccionar un esquema de color para su sitio, debe asegurarse de que sea accesible para todos. Uno genial [herramienta para generar paletas de colores es Color Safe](http://colorsafe.co/).
La gente ve el mundo de diferentes formas, y esto incluye los colores. Al seleccionar un esquema de color para tu sitio, debes asegurarte de que sea accesible para todos. Una [herramiento genial para generar paletas de colores es Color Safe](http://colorsafe.co/).
✅ Identifique un sitio web que sea muy problemático en el uso del color. ¿Por qué?
✅ Identifica un sitio web que sea muy problemático en el uso del color. ¿Por qué?
### Resaltar correctamente el texto
Resaltar texto por color, [peso de fuente](https://developer.mozilla.org/docs/Web/CSS/font-weight) u otra [decoración de texto](https://developer.mozilla.org/docs/Web/CSS/text-decoration) no informa inherentemente a un lector de pantalla de su importancia. Una palabra puede ser en negrita porque es una palabra clave o porque es la primera palabra y el diseñador decidió que debería ser en negrita.
Resaltar texto por color, [peso de fuente](https://developer.mozilla.org/docs/Web/CSS/font-weight) u otra [decoración de texto](https://developer.mozilla.org/docs/Web/CSS/text-decoration) no informa inherentemente a un lector de pantalla de su importancia. Una palabra puede estar en negrita porque es una palabra clave o porque es la primera palabra, y el diseñador decidió que debería estar en negrita.
Cuando sea necesario resaltar una frase en particular, utilice los elementos `<strong>` o `<em>`. Estos le indicarán a un lector de pantalla que esos elementos son importantes.
Cuando sea necesario resaltar una frase en particular, utilice los elementos `<strong>` o `<em>`. Estos te indicarán a un lector de pantalla que esos elementos son importantes.
### Usa el HTML correcto
Con CSS y JavaScript es posible que muchos elementos se parezcan a cualquier tipo de control. `<span>` podría usarse para crear un `<button>`, y `<b>` podría convertirse en un hipervínculo. Si bien esto podría considerarse más fácil de diseñar, es desconcertante para un lector de pantalla. Utilice el HTML apropiado al crear controles en una página. Si desea un hipervínculo, use `<a>`. Usar el HTML correcto para el control correcto se llama hacer uso de HTML semántico.
Con CSS y JavaScript es posible que muchos elementos se parezcan a cualquier tipo de control. `<span>` podría usarse para crear un `<button>`, y `<b>` podría convertirse en un enlace. Si bien esto podría considerarse más fácil de diseñar, es desconcertante para un lector de pantalla. Utiliza el HTML apropiado al crear controles en una página. Si deseas un enlace, usa `<a>`. Usar el HTML correcto para el control correcto se llama hacer uso de **HTML semántico**.
✅ Vaya a cualquier sitio web y vea si los diseñadores y desarrolladores están usando HTML correctamente. ¿Puedes encontrar un botón que debería ser un enlace? Sugerencia: haga clic derecho y elija 'View Page Source' en su navegador para ver el código subyacente.
✅ Vaya a cualquier sitio web y vea si los diseñadores y desarrolladores están usando HTML correctamente. ¿Puedes encontrar un botón que debería ser un enlace? Sugerencia: haga clic derecho y elige 'View Page Source' en tu navegador para ver el código subyacente.
### Usa buenas pistas visuales
CSS ofrece un control completo sobre el aspecto de cualquier elemento de una página. Puede crear cuadros de texto sin contorno o hipervínculos sin subrayado. Desafortunadamente, eliminar esas pistas puede hacer que sea más difícil para alguien que depende de ellas poder reconocer el tipo de control.
CSS ofrece un control completo sobre el aspecto de cualquier elemento de una página. Puedes crear cuadros de texto sin contorno o hipervínculos sin subrayado. Desafortunadamente, eliminar esas pistas puede hacer que sea más difícil para alguien que depende de ellas poder reconocer el tipo de control.
## La importancia del texto del enlace
@ -80,19 +80,19 @@ Como era de esperar, los lectores de pantalla leen el texto del enlace de la mis
> El pequeño pingüino, a veces conocido como el pingüino de hadas, es el pingüino más pequeño del mundo. [Haga clic aquí](https://en.wikipedia.org/wiki/Little_penguin) para obtener más información.
> El pequeño pingüino, a veces conocido como el pingüino de hadas, es el pingüino más pequeño del mundo. Visite https://en.wikipedia.org/wiki/Little_penguin para obtener más información.
> El pequeño pingüino, a veces conocido como el pingüino de hadas, es el pingüino más pequeño del mundo. Visita https://en.wikipedia.org/wiki/Little_penguin para obtener más información.
> ** NOTA ** Mientras estás a punto de leer, ** nunca ** debes crear enlaces que se parezcan al anterior.
> **NOTA** Mientras estás a punto de leer, **nunca** debes crear enlaces que se parezcan al anterior.
Recuerde, los lectores de pantalla son una interfaz diferente de los navegadores con un conjunto diferente de características.
Recuerda, los lectores de pantalla son una interfaz diferente de los navegadores con diferentes características.
### El problema con el uso de la URL
### El problema con el uso de URLs
Los lectores de pantalla leen el texto. Si aparece una URL en el texto, el lector de pantalla leerá la URL. En términos generales, la URL no transmite información significativa y puede sonar molesta. Es posible que haya experimentado esto si su teléfono alguna vez leyó de manera audible un mensaje de texto con una URL.
Los lectores de pantalla leen el texto. Si aparece un URL en el texto, el lector de pantalla leerá el URL. En términos generales, un URL no transmite información significativa y puede sonar molesto. Es posible que hayas experimentado esto si tu teléfono alguna vez leyó de manera audible un mensaje de texto con un URL.
### El problema con "haga clic aquí"
Los lectores de pantalla también tienen la capacidad de leer solo los hipervínculos en una página, de la misma manera que una persona con visión escanea una página en busca de enlaces. Si el texto del vínculo es siempre "haga clic aquí", todo lo que el usuario oirá es "haga clic aquí, haga clic aquí, haga clic aquí, haga clic aquí, haga clic aquí, ..." Todos los enlaces ahora son indistinguibles entre sí.
Los lectores de pantalla también tienen la capacidad de leer solo los enlaces en una página, de la misma manera que una persona con visión escanea una página en busca de enlaces. Si el texto del vínculo es siempre "haga clic aquí", todo lo que el usuario oirá es "haga clic aquí, haga clic aquí, haga clic aquí, haga clic aquí, haga clic aquí, ..." Todos los enlaces ahora son indistinguibles entre sí.
### Buen texto de enlace
@ -100,11 +100,11 @@ Un buen texto de enlace describe brevemente lo que está al otro lado del enlace
> El [pingüino pequeño](https://en.wikipedia.org/wiki/Little_penguin), a veces conocido como el pingüino de hadas, es el pingüino más pequeño del mundo.
✅ Navegue por la web durante unos minutos para encontrar páginas que utilicen estrategias de enlace poco conocidas. Compárelos con otros sitios mejor vinculados. ¿Qué aprendes?
✅ Navega la web unos minutos hasta encontrar páginas que utilicen estrategias de enlace poco conocidas. Compáralos con otros sitios que demuestren mejores enlaces. ¿Qué aprendiste?
#### Notas del motor de búsqueda
#### Notas sobre motores de búsqueda (search engines)
Como una ventaja adicional para garantizar que su sitio sea accesible para todos, también ayudará a los motores de búsqueda a navegar por su sitio. Los motores de búsqueda utilizan el texto del enlace para conocer los temas de las páginas. ¡Así que usar un buen texto de enlace ayuda a todos!
Además de la ventaja de que ahora tu sitio sea accesible para todos, también ayudas a los motores de búsqueda a navegar mejor tu sitio. Los motores de búsqueda utilizan el texto del enlace para conocer los temas de las páginas. ¡Así que usar un buen texto de enlace ayuda a todos!
### ARIA
@ -115,11 +115,11 @@ Imagina la siguiente página:
| Widget | [Descripción]('#') | [Orden]('#') |
| Super widget | [Descripción]('#') | [Orden]('#') |
En este ejemplo, duplicar el texto de descripción y orden tiene sentido para alguien que usa un navegador. Sin embargo, alguien que use un lector de pantalla solo escuchará las palabras * descripción * y * orden * repetidas sin contexto.
En este ejemplo, duplicar el texto de descripción y orden tiene sentido para alguien que usa un navegador. Sin embargo, alguien que use un lector de pantalla solo escuchará las palabras *descripción* y *orden* repetidas sin contexto.
Para admitir este tipo de escenarios, HTML admite un conjunto de atributos conocidos como [Aplicaciones de Internet enriquecidas accesibles (ARIA)](https://developer.mozilla.org/docs/Web/Accessibility/ARIA). Estos atributos le permiten proporcionar información adicional a los lectores de pantalla.
Para apoyar este tipo de escenarios, HTML apoya un conjunto de atributos conocidos como [Aplicaciones de Internet enriquecidas accesibles (ARIA)](https://developer.mozilla.org/docs/Web/Accessibility/ARIA). Estos atributos te permiten proporcionar información adicional a los lectores de pantalla.
> **NOTA**: Al igual que muchos aspectos de HTML, la compatibilidad con el navegador y el lector de pantalla puede variar. Sin embargo, la mayoría de los clientes de la línea principal admiten atributos ARIA.
> **NOTA**: Al igual que muchos aspectos de HTML, la compatibilidad con el navegador y el lector de pantalla pueden variar. Sin embargo, la mayoría de los clientes de la línea principal apoyan atributos ARIA.
Puedes usar `aria-label` para describir el enlace cuando el formato de la página no te lo permite. La descripción del widget podría establecerse como
@ -127,14 +127,14 @@ Puedes usar `aria-label` para describir el enlace cuando el formato de la págin
<a href="#" aria-label="Widget description">descripción</a>
```
✅ En general, el uso de marcado semántico como se describe arriba reemplaza el uso de ARIA, pero a veces no existe un equivalente semántico para varios widgets HTML. Un buen ejemplo es una barra de progreso. No hay un equivalente HTML para una barra de progreso, por lo que identifica el `<div>` genérico para este elemento con un rol y valores de aria adecuados. La [documentación de MDN sobre ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) contiene más información útil.
✅ En general, el uso de HTML semántico como se describe arriba reemplaza el uso de ARIA, pero a veces no existe un equivalente semántico para varios widgets HTML. Un buen ejemplo es una barra de progreso. No hay un equivalente HTML para una barra de progreso, por lo que identifica el `<div>` genérico para este elemento con un rol y valores de aria adecuados. La [documentación de MDN sobre ARIA](https://developer.mozilla.org/docs/Web/Accessibility/ARIA) contiene más información útil.
```html
<div id="percent-loaded" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
</div>
```
## Imagenes
## Imágenes
No hace falta decir que los lectores de pantalla no pueden leer automáticamente lo que hay en una imagen. Asegurarse de que las imágenes sean accesibles no requiere mucho trabajo; de eso se trata el atributo ʻalt`. Todas las imágenes deben tener un ʻalt` para describir lo que son.
@ -142,74 +142,74 @@ No hace falta decir que los lectores de pantalla no pueden leer automáticamente
## El teclado
Algunos usuarios no pueden usar un mouse o trackpad, sino que dependen de las interacciones del teclado para pasar de un elemento al siguiente. Es importante que su sitio web presente su contenido en un orden lógico para que un teclado pueda acceder a cada elemento a medida que el usuario avanza por un documento. Si construye sus páginas web con marcado semántico y usa CSS para diseñar su diseño visual, su sitio debe ser navegable por teclado, pero es importante probar este aspecto manualmente. Obtenga más información sobre las [estrategias de navegación por teclado](https://webaim.org/techniques/keyboard/).
Algunos usuarios no pueden usar un mouse o trackpad, sino que dependen de las interacciones del teclado para pasar de un elemento al siguiente. Es importante que tu sitio web presente tu contenido en un orden lógico para que un teclado pueda acceder a cada elemento a medida que el usuario avanza por un documento. Si construyes tus páginas web con HTML semántico y usas CSS para diseñar tu diseño visual, tu sitio debe ser navegable por teclado, pero es importante comprobar este aspecto manualmente. Obtén más información sobre las [estrategias de navegación por teclado](https://webaim.org/techniques/keyboard/).
✅ Vaya a cualquier sitio web e intente navegar por él utilizando solo la tecla de tabulación. ¿Qué funciona, qué no funciona? ¿Por qué?
✅ Ve a cualquier sitio web e intenta navegar por él, utilizando solo la tecla de tabulación. ¿Qué funciona, qué no funciona? ¿Por qué?
## Resumen
Una web accesible para algunos no es una verdadera "red mundial". La mejor manera de garantizar que los sitios que cree sean accesibles es incorporar las mejores prácticas de accesibilidad desde el principio. Si bien hay pasos adicionales involucrados, incorporar estas habilidades en su flujo de trabajo ahora significará que todas las páginas que cree serán accesibles.
Una web accesible para algunos no es una verdadera "red mundial". La mejor manera de garantizar que los sitios que creas sean accesibles, es incorporar las mejores prácticas de accesibilidad desde el principio. Si bien hay pasos adicionales involucrados, incorporar estas habilidades en tu flujo de trabajo ahora significará que todas las páginas que creas sean accesibles.
🚀 Desafío: tome este HTML y vuelva a escribirlo para que sea lo más accesible posible, dados los temas que aprendió.
🚀 Desafío: toma este HTML y vuelve a escribirlo para que sea lo más accesible posible, dados los temas que aprendiste.
```html
<!DOCTYPE html>
<html>
<head>
<title>
Example
Ejemplo
</title>
<link href='../assets/style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="site-header">
<p class="site-title">Turtle Ipsum</p>
<p class="site-subtitle">The World's Premier Turtle Fan Club</p>
<p class="site-title">Tortuga Ipsum</p>
<p class="site-subtitle">El club de fans de tortugas más importante del mundo</p>
</div>
<div class="main-nav">
<p class="nav-header">Resources</p>
<p class="nav-header">Recursos</p>
<div class="nav-list">
<p class="nav-item nav-item-bull"><a href="https://www.youtube.com/watch?v=CMNry4PE93Y">"I like turtles"</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Turtle">Basic Turtle Info</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Turtles_(chocolate)">Chocolate Turtles</a></p>
<p class="nav-item nav-item-bull"><a href="https://www.youtube.com/watch?v=CMNry4PE93Y">"Me gustan las tortugas"</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Tortuga">Info básico de tortugas</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Tortugas_(chocolate)">Tortugas de chocolate</a></p>
</div>
</div>
<div class="main-content">
<div>
<p class="page-title">Welcome to Turtle Ipsum.
<a href="">Click here</a> to learn more.
<p class="page-title">Bienvenida a la Tortuga Ipsum.
<a href="">Haz clic aquí</a> para aprender más.
</p>
<p class="article-text">
Turtle ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
Tortuga ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</p>
</div>
</div>
<div class="footer">
<div class="footer-section">
<span class="button">Sign up for turtle news</span>
<span class="button">Regístrese para recibir 'Noticias Tortuga'</span>
</div><div class="footer-section">
<p class="nav-header footer-title">
Internal Pages
</p>
<div class="nav-list">
<p class="nav-item nav-item-bull"><a href="../">Index</a></p>
<p class="nav-item nav-item-bull"><a href="../semantic">Semantic Example</a></p>
<p class="nav-item nav-item-bull"><a href="../">Índice</a></p>
<p class="nav-item nav-item-bull"><a href="../semantic">Ejemplo Semántico</a></p>
</div>
</div>
<p class="footer-copyright">&copy; 2016 Instrument</span>
<p class="footer-copyright">&copy; Instrument 2016</span>
</div>
</body>
</html>
```
## [Post-lecture prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/6)
## [Post-lectura prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/6)
## Revisión y autoestudio
## Revisión y auto-estudio
Muchos gobiernos tienen leyes sobre los requisitos de accesibilidad. Lea sobre las leyes de accesibilidad de su país de origen. ¿Qué está cubierto y qué no? Un ejemplo es [este sitio web del gobierno](https://accessibility.blog.gov.uk/).
Muchos gobiernos tienen leyes sobre los requisitos de accesibilidad. Lee sobre las leyes de accesibilidad de tu país de origen. ¿Qué está cubierto y qué no? Un ejemplo es [este sitio web de gobierno](https://accessibility.blog.gov.uk/).
** Tarea **: [Analizar un sitio web no accesible](assignment.es.md)
Credits: [Turtle Ipsum](https://github.com/Instrument/semantic-html-sample) por Instrument
Créditos: [Tortuga Ipsum](https://github.com/Instrument/semantic-html-sample) por Instrument
> Autor: Christopher Harrison
> Autor: Christopher Harrison

@ -1,6 +1,6 @@
# Membuat Halaman Web yang Dapat Diakses (oleh Semua Orang)
![Semua Tentang Aksesibilitas](../webdev101-a11y.png)
![Semua Tentang Aksesibilitas](/sketchnotes/webdev101-a11y.png)
> Catatan sketsa oleh [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuis Pra-Kuliah
@ -25,7 +25,7 @@ Pada dasarnya, pembaca layar akan membaca halaman dari atas ke bawah dengan suar
Setiap pengembang web harus membiasakan diri dengan pembaca layar. Seperti yang disorot di atas, itu adalah klien yang akan digunakan pengguna Anda. Sama seperti saat Anda memahami cara kerja browser, Anda juga harus mempelajari cara kerja pembaca layar. Untungnya, pembaca layar sudah terpasang di sebagian besar sistem operasi, dan banyak browser berisi ekstensi untuk meniru pembaca layar.
✅ Coba ekstensi atau alat browser pembaca layar. Salah satu yang hanya berfungsi di Windows adalah [JAWS](https://webaim.org/articles/jaws/). Peramban (browser) juga memiliki alat bawaan yang dapat digunakan untuk tujuan ini; lihat [alat browser Edge yang berfokus pada aksesibilitas ini](https://support.microsoft.com/en-us/help/4000734/microsoft-edge-accessibility-features).
✅ Coba ekstensi atau alat browser pembaca layar. Salah satu yang hanya berfungsi di Windows adalah [JAWS](https://webaim.org/articles/jaws/). Peramban (browser) juga memiliki alat bawaan yang dapat digunakan untuk tujuan ini; lihat [alat browser Edge yang berfokus pada aksesibilitas ini](https://support.microsoft.com/help/4000734/microsoft-edge-accessibility-features).
### Pemeriksa kontras
@ -129,7 +129,7 @@ Anda dapat menggunakan `aria-label` untuk mendeskripsikan link jika format halam
<a href="#" aria-label="Deskripsi widget">deskripsi</a>
```
✅ Secara umum, menggunakan markup Semantik seperti yang dijelaskan di atas menggantikan penggunaan ARIA, tetapi terkadang tidak ada padanan semantik untuk berbagai widget HTML. Contoh yang bagus adalah Progressbar. Tidak ada HTML yang setara untuk bilah kemajuan, jadi Anda mengidentifikasi `<div>` generik untuk elemen ini dengan peran yang tepat dan nilai aria. [Dokumentasi MDN tentang ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) berisi informasi yang lebih berguna.
✅ Secara umum, menggunakan markup Semantik seperti yang dijelaskan di atas menggantikan penggunaan ARIA, tetapi terkadang tidak ada padanan semantik untuk berbagai widget HTML. Contoh yang bagus adalah Progressbar. Tidak ada HTML yang setara untuk bilah kemajuan, jadi Anda mengidentifikasi `<div>` generik untuk elemen ini dengan peran yang tepat dan nilai aria. [Dokumentasi MDN tentang ARIA](https://developer.mozilla.org/docs/Web/Accessibility/ARIA) berisi informasi yang lebih berguna.
```html
<div id="percent-loaded" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">

@ -1,6 +1,6 @@
# Creare Pagine Web Accessibili
![Tutto quanto riguarda l'Accessibilità](../webdev101-a11y.png)
![Tutto quanto riguarda l'Accessibilità](/sketchnotes/webdev101-a11y.png)
> Sketchnote di [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz Pre-Lezione
@ -24,15 +24,15 @@ Nella sua forma più elementare, uno screen reader leggerà una pagina dall'alto
Ogni sviluppatore web dovrebbe acquisire familiarità con uno screen reader. Come evidenziato sopra, è il client che gli utenti dello sviluppatore utilizzeranno. Allo stesso modo in cui si ha familiarità con il funzionamento di un browser, si dovrebbe imparare come funziona uno screen reader. Fortunatamente, gli screen reader sono integrati nella maggior parte dei sistemi operativi.
Alcuni browser hanno anche strumenti incorporati ed estensioni che possono leggere il testo ad alta voce o persino fornire alcune funzionalità di navigazione di base, come [questi strumenti orientati all'accessibilità del browser Edge](https://support.microsoft.com/en-us/help/4000734/microsoft-edge-accessibility-features) . Anche questi sono importanti strumenti di accessibilità, ma funzionano in modo molto diverso dagli screen reader e non dovrebbero essere scambiati per strumenti di test per uno screen reader.
Alcuni browser hanno anche strumenti incorporati ed estensioni che possono leggere il testo ad alta voce o persino fornire alcune funzionalità di navigazione di base, come [questi strumenti orientati all'accessibilità del browser Edge](https://support.microsoft.com/help/4000734/microsoft-edge-accessibility-features) . Anche questi sono importanti strumenti di accessibilità, ma funzionano in modo molto diverso dagli screen reader e non dovrebbero essere scambiati per strumenti di test per uno screen reader.
✅ Provare un lettore di schermo e un lettore di testo del browser. In Windows, l'[Assistente vocale](https://support.microsoft.com/en-us/windows/complete-guide-to-narrator-e4397a0d-ef4f-b386-d8ae-c172f109bdb1) (Narrator) è incluso per impostazione predefinita e anche [JAWS](https://webaim.org/articles/jaws/) e [NVDA](https://www.nvaccess.org/about-nvda/) possono essere installati Su macOS e iOS, [VoiceOver](https://support.apple.com/guide/voiceover/welcome/10) è installato per impostazione predefinita.
✅ Provare un lettore di schermo e un lettore di testo del browser. In Windows, l'[Assistente vocale](https://support.microsoft.com/windows/complete-guide-to-narrator-e4397a0d-ef4f-b386-d8ae-c172f109bdb1) (Narrator) è incluso per impostazione predefinita e anche [JAWS](https://webaim.org/articles/jaws/) e [NVDA](https://www.nvaccess.org/about-nvda/) possono essere installati Su macOS e iOS, [VoiceOver](https://support.apple.com/guide/voiceover/welcome/10) è installato per impostazione predefinita.
### Zoom
Un altro strumento comunemente utilizzato dalle persone con problemi di vista è lo zoom. Il tipo più semplice di zoom è lo zoom statico, controllato tramite `Control + segno più (+)` o diminuendo la risoluzione dello schermo. Questo tipo di zoom provoca il ridimensionamento dell'intera pagina, quindi l'utilizzo [di una progettazione responsive](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Responsive_Design) della pagina è importante per fornire una buona esperienza utente a livelli di zoom aumentati.
Un altro strumento comunemente utilizzato dalle persone con problemi di vista è lo zoom. Il tipo più semplice di zoom è lo zoom statico, controllato tramite `Control + segno più (+)` o diminuendo la risoluzione dello schermo. Questo tipo di zoom provoca il ridimensionamento dell'intera pagina, quindi l'utilizzo [di una progettazione responsive](https://developer.mozilla.org/docs/Learn/CSS/CSS_layout/Responsive_Design) della pagina è importante per fornire una buona esperienza utente a livelli di zoom aumentati.
Un altro tipo di zoom si basa su un software specializzato per ingrandire un'area dello schermo e fare una panoramica, proprio come usare una vera lente di ingrandimento. Su Windows, [Magnifier](https://support.microsoft.com/en-us/windows/use-magnifier-to-make-things-on-the-screen-easier-to-see-414948ba-8b1c-d3bd-8615-0e5e32204198) è integrato e [ZoomText](https://www.freedomscientific.com/training/zoomtext/getting-started/) è un software di ingrandimento di terze parti con più funzionalità e una base di utenti più ampia. Sia macOS che iOS hanno un software di ingrandimento integrato chiamato [Zoom](https://www.apple.com/accessibility/mac/vision/).
Un altro tipo di zoom si basa su un software specializzato per ingrandire un'area dello schermo e fare una panoramica, proprio come usare una vera lente di ingrandimento. Su Windows, [Magnifier](https://support.microsoft.com/windows/use-magnifier-to-make-things-on-the-screen-easier-to-see-414948ba-8b1c-d3bd-8615-0e5e32204198) è integrato e [ZoomText](https://www.freedomscientific.com/training/zoomtext/getting-started/) è un software di ingrandimento di terze parti con più funzionalità e una base di utenti più ampia. Sia macOS che iOS hanno un software di ingrandimento integrato chiamato [Zoom](https://www.apple.com/accessibility/mac/vision/).
### Verificatori di contrasto
@ -133,7 +133,7 @@ E' possibile utilizzare `aria-label` per descrivere il collegamento quando il fo
<a href="#" aria-label="Widget description">description</a>
```
✅ In generale, l'uso del markup semantico come descritto sopra sostituisce l'uso di ARIA, ma a volte non esiste un equivalente semantico per diversi widget HTML. Un buon esempio è una struttura ad albero. Non esiste un equivalente HTML per una struttura ad albero, quindi si identifica il generico `<div>` per questo elemento con un ruolo e valori aria appropriati. La [documentazione MDN su ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) contiene ulteriori utili informazioni.
✅ In generale, l'uso del markup semantico come descritto sopra sostituisce l'uso di ARIA, ma a volte non esiste un equivalente semantico per diversi widget HTML. Un buon esempio è una struttura ad albero. Non esiste un equivalente HTML per una struttura ad albero, quindi si identifica il generico `<div>` per questo elemento con un ruolo e valori aria appropriati. La [documentazione MDN su ARIA](https://developer.mozilla.org/docs/Web/Accessibility/ARIA) contiene ulteriori utili informazioni.
```html
<h2 id="tree-label">File Viewer</h2>
@ -223,6 +223,6 @@ Molti governi hanno leggi riguardanti i requisiti di accessibilità. Consultare
## Assegnazione
[Analizzare un sito web non accessibile](assignment.md)
[Analizzare un sito web non accessibile](assignment.it.md)
Crediti: [Turtle Ipsum](https://github.com/Instrument/semantic-html-sample) da Instrument

@ -1,6 +1,6 @@
# アクセシブルな Web ページの作成
![All About Accessibility](../webdev101-a11y.png)
![All About Accessibility](/sketchnotes/webdev101-a11y.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## レッスン前の小テスト

@ -1,6 +1,6 @@
# 접근 가능한 웹 페이지 생성하기
![All About Accessibility](../webdev101-a11y.png)
![All About Accessibility](/sketchnotes/webdev101-a11y.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## 강의 전 퀴즈
@ -24,7 +24,7 @@
모든 웹 개발자는 스크린 리더에 익숙해야합니다. 위에서 강조한 것처럼 사용자가 활용할 클라이언트입니다. 브라우저가 작동하는 방식에 익숙한 것과 마찬가지로 스크린 리더가 작동하는 방식을 배워야합니다. 다행히 스크린 리더는 대부분의 운영체제에 내장되어 있으며, 많은 브라우저에는 스크린 리더를 모방하는 확장이 포함되어 있습니다.
✅ 스크린 리더 브라우저 확장이나 도구를 시도해보세요.[JAWS](https://webaim.org/articles/jaws/)는 윈도우에서만 작동합니다. 브라우저에는 이러한 목적으로 사용할 수 있는 내장 도구도 있습니다; [these accessibility-focused Edge browser tools](https://support.microsoft.com/en-us/help/4000734/microsoft-edge-accessibility-features) 확인합니다.
✅ 스크린 리더 브라우저 확장이나 도구를 시도해보세요.[JAWS](https://webaim.org/articles/jaws/)는 윈도우에서만 작동합니다. 브라우저에는 이러한 목적으로 사용할 수 있는 내장 도구도 있습니다; [these accessibility-focused Edge browser tools](https://support.microsoft.com/help/4000734/microsoft-edge-accessibility-features) 확인합니다.
### Contrast checkers
@ -127,7 +127,7 @@ CSS는 페이지에 있는 모든 요소의 형태를 완벽하게 제어합니
<a href="#" aria-label="Widget description">description</a>
```
✅ 일반적으로, 위에서 설명한 시맨틱 마크업을 사용하는 것은 ARIA의 사용을 대체하지만, 때때로 다양한 HTML 위젯에 해당하는 시맨틱이 없습니다. 좋은 예는 Progressbar입니다. 진행률 표시줄에 해당하는 HTML이 없으므로 적절한 역할 및 aria 값을 사용하여 일반 `<div>`를 식별합니다. [AMDN documentation on ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA)에 더 유용한 정보가 포함되어 있습니다.
✅ 일반적으로, 위에서 설명한 시맨틱 마크업을 사용하는 것은 ARIA의 사용을 대체하지만, 때때로 다양한 HTML 위젯에 해당하는 시맨틱이 없습니다. 좋은 예는 Progressbar입니다. 진행률 표시줄에 해당하는 HTML이 없으므로 적절한 역할 및 aria 값을 사용하여 일반 `<div>`를 식별합니다. [AMDN documentation on ARIA](https://developer.mozilla.org/docs/Web/Accessibility/ARIA)에 더 유용한 정보가 포함되어 있습니다.
```html
<div id="percent-loaded" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">

@ -1,6 +1,6 @@
# Membuat Halaman Web yang Boleh Diakses
![Semua Tentang Kebolehcapaian](../webdev101-a11y.png)
![Semua Tentang Kebolehcapaian](/sketchnotes/webdev101-a11y.png)
> Sketchnote karya [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuiz Pra Kuliah
@ -24,7 +24,7 @@ Pada asasnya, pembaca skrin akan membaca halaman dari atas ke bawah dengan diden
Setiap pembangun web harus membiasakan diri dengan pembaca skrin. Seperti yang dinyatakan di atas, ini adalah pelanggan yang akan digunakan pengguna anda Sama seperti anda mengetahui bagaimana penyemak imbas beroperasi, anda harus mengetahui cara pembaca skrin beroperasi. Nasib baik pembaca skrin dimasukkan ke dalam kebanyakan sistem operasi, dan banyak penyemak imbas mengandungi sambungan untuk meniru pembaca skrin.
✅ Cuba pelanjutan atau alat penyemak imbas pembaca skrin. Yang hanya berfungsi pada Windows ialah [JAWS](https://webaim.org/articles/jaws/). Penyemak imbas juga mempunyai alat bawaan yang dapat digunakan untuk tujuan ini; cuba [alat penyemak imbas Edge yang berfokus kebolehaksesan ini](https://support.microsoft.com/en-us/help/4000734/microsoft-edge-accessibility-features).
✅ Cuba pelanjutan atau alat penyemak imbas pembaca skrin. Yang hanya berfungsi pada Windows ialah [JAWS](https://webaim.org/articles/jaws/). Penyemak imbas juga mempunyai alat bawaan yang dapat digunakan untuk tujuan ini; cuba [alat penyemak imbas Edge yang berfokus kebolehaksesan ini](https://support.microsoft.com/help/4000734/microsoft-edge-accessibility-features).
### Pemeriksa Kontras
@ -127,7 +127,7 @@ Anda boleh menggunakan `aria-label` untuk menerangkan pautan apabila format hala
<a href="#" aria-label="Widget description">description</a>
```
✅ Secara umum, menggunakan markup Semantik seperti yang dijelaskan di atas menggantikan penggunaan ARIA, tetapi kadang-kadang tidak ada yang setara dengan semantik untuk pelbagai widget HTML. Contoh yang baik ialah Progressbar. Tidak ada setara HTML untuk bar kemajuan, jadi anda mengenal pasti generik `<div>` untuk elemen ini dengan peranan dan nilai aria yang betul. [MDN documentation on ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) mengandungi maklumat yang lebih berguna.
✅ Secara umum, menggunakan markup Semantik seperti yang dijelaskan di atas menggantikan penggunaan ARIA, tetapi kadang-kadang tidak ada yang setara dengan semantik untuk pelbagai widget HTML. Contoh yang baik ialah Progressbar. Tidak ada setara HTML untuk bar kemajuan, jadi anda mengenal pasti generik `<div>` untuk elemen ini dengan peranan dan nilai aria yang betul. [MDN documentation on ARIA](https://developer.mozilla.org/docs/Web/Accessibility/ARIA) mengandungi maklumat yang lebih berguna.
```html
<div id="percent-loaded" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">

@ -0,0 +1,229 @@
# Toegankelijke webpagina's maken
![Alles over toegankelijkheid](/sketchnotes/webdev101-a11y.png)
> Sketchnote door [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz voorafgaand aan de lezing
[Quiz voorafgaand aan de lezing](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/5)
> De kracht van het web zit in zijn universaliteit. Toegang voor iedereen, ongeacht hun handicap, is een essentieel aspect.
>
> \- Sir Timothy Berners-Lee, W3C-directeur en uitvinder van het World Wide Web
Deze quote benadrukt perfect het belang van het creëren van toegankelijke websites. Een applicatie die niet voor iedereen toegankelijk is, is per definitie uitsluiting. Als webontwikkelaars moeten we altijd rekening houden met toegankelijkheid. Door deze focus vanaf het begin te hebben, bent u goed op weg om ervoor te zorgen dat iedereen toegang heeft tot de pagina's die u maakt. In deze les leert u over de tools die u kunnen helpen ervoor te zorgen dat uw webitems toegankelijk zijn en hoe u kunt bouwen met toegankelijkheid in gedachten.
## Tools om te gebruiken
### Schermlezers
Een van de bekendste toegankelijkheidstools zijn schermlezers.
[Schermlezers](https://nl.wikipedia.org/wiki/Schermlezer) zijn veelgebruikte clients voor mensen met een visuele beperking. Omdat we er tijd voor besteden om ervoor te zorgen dat een browser de informatie die we willen delen correct overbrengt, moeten we er ook voor zorgen dat een schermlezer hetzelfde doet.
In de basis leest een schermlezer een pagina hoorbaar van boven naar beneden. Als uw pagina alleen uit tekst bestaat, zal de lezer de informatie op dezelfde manier overbrengen naar een browser. Webpagina's zijn natuurlijk zelden louter tekst; ze bevatten links, afbeeldingen, kleur en andere visuele componenten. Er moet voor worden gezorgd dat deze informatie correct wordt gelezen door een schermlezer.
Elke webontwikkelaar moet vertrouwd raken met een schermlezer. Zoals hierboven aangegeven, is het de client die uw gebruikers zullen gebruiken. Net zoals u bekend bent met hoe een browser werkt, moet u leren hoe een schermlezer werkt. Gelukkig zijn schermlezers in de meeste besturingssystemen ingebouwd.
Sommige browsers hebben ook ingebouwde tools en extensies die tekst hardop kunnen voorlezen of zelfs enkele basisnavigatiefuncties bieden, zoals [deze op toegankelijkheid gerichte Edge-browserhulpmiddelen](https://support.microsoft.com/nl-nl/microsoft-edge/toegankelijkheidsfuncties-in-microsoft-edge-4c696192-338e-9465-b2cd-bd9b698ad19a). Dit zijn ook belangrijke toegankelijkheidstools, maar ze werken heel anders dan schermlezers en ze mogen niet worden aangezien voor testtools voor schermlezers.
✅ Probeer een schermlezer en browsertekstlezer. Op Windows is [Narrator](https://support.microsoft.com/nl-nl/windows/volledige-handleiding-voor-verteller-e4397a0d-ef4f-b386-d8ae-c172f109bdb1) standaard inbegrepen, en [JAWS](https://webaim.org/articles/jaws/) en [NVDA](https://www.nvaccess.org/about-nvda/) kunnen ook worden geïnstalleerd. Op macOS en iOS is [VoiceOver](https://support.apple.com/guide/voiceover/welcome/10) standaard geïnstalleerd.
### Zoom
Een ander hulpmiddel dat vaak wordt gebruikt door mensen met een visuele beperking, is zoomen. De meest basale manier van zoomen is statische zoom, bestuurd via `Control + plusteken (+)` of door de schermresolutie te verlagen. Dit type zoom zorgt ervoor dat het formaat van de hele pagina wordt aangepast, dus het gebruik van [responsive design](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Responsive_Design) is belangrijk om een goede gebruikerservaring te bieden bij verhoogde zoomniveaus.
Een ander type zoom is afhankelijk van gespecialiseerde software om een deel van het scherm te vergroten en te pannen, net zoals bij het gebruik van een echt vergrootglas. Op Windows is [Magnifier](https://support.microsoft.com/nl-nl/windows/vergrootglas-gebruiken-voor-een-betere-zichtbaarheid-op-het-scherm-414948ba-8b1c-d3bd-8615-0e5e32204198) ingebouwd en [ZoomText](https://www.freedomscientific.com/training/zoomtext/getting-started/) is vergrotingssoftware van derden met meer functies en een groter gebruikersbestand. Zowel macOS als iOS hebben ingebouwde vergrotingssoftware genaamd [Zoom](https://www.apple.com/nl/accessibility/vision/).
### Contrast checkers
Kleuren op websites moeten zorgvuldig worden gekozen om tegemoet te komen aan de behoeften van kleurenblinde gebruikers of mensen die moeite hebben met het zien van kleuren met een laag contrast.
✅ Test een website die u graag gebruikt voor kleurgebruik met een browserextensie zoals [WCAG's color checker](https://microsoftedge.microsoft.com/addons/detail/wcag-color-contrast-check/idahaggnlnekelhgplklhfpchbfdmkjp?hl=en-US). Wat leer je?
### Lighthouse
In het ontwikkelaarstoolgedeelte van uw browser vindt u de Lighthouse-tool. Deze tool is belangrijk om een eerste beeld te krijgen van de toegankelijkheid (en ook andere analyses) van een website. Hoewel het belangrijk is om niet uitsluitend op Lighthouse te vertrouwen, is een score van 100% erg nuttig als uitgangspunt.
✅ Zoek Lighthouse in het ontwikkelaarstoolpaneel van uw browser en voer een analyse uit op elke site. wat ontdek je?
## Ontwerpen voor toegankelijkheid
Toegankelijkheid is een relatief groot onderwerp. Om u te helpen, zijn er tal van bronnen beschikbaar.
- [Accessible U - University of Minnesota](https://accessibility.umn.edu/your-role/web-developers)
Hoewel we niet elk aspect van het maken van toegankelijke sites kunnen behandelen, staan hieronder enkele van de kernprincipes die u wilt implementeren. Het ontwerpen van een toegankelijke pagina vanaf het begin is **altijd** gemakkelijker dan teruggaan naar een bestaande pagina om deze toegankelijk te maken.
## Goede weergaveprincipes
### Kleur veilige paletten
Mensen zien de wereld op verschillende manieren, inclusief kleuren. Wanneer u een kleurenschema voor uw site selecteert, moet u ervoor zorgen dat het voor iedereen toegankelijk is. Een geweldig [hulpmiddel voor het genereren van kleurenpaletten is Color Safe](http://colorsafe.co/).
✅ Identificeer een website die erg problematisch is in het gebruik van kleur. Waarom?
### Gebruik de juiste HTML
Met CSS en JavaScript is het mogelijk om elk element eruit te laten zien als elk type besturingselement. `<span>` kan worden gebruikt om een `<button>` te maken en `<b>` kan een hyperlink worden. Hoewel dit misschien als gemakkelijker te stylen wordt beschouwd, brengt het niets over op een schermlezer. Gebruik de juiste HTML bij het maken van besturingselementen op een pagina. Als u een hyperlink wilt, gebruik dan `<a>`. Het gebruik van de juiste HTML voor de juiste besturing wordt het gebruik van Semantische HTML genoemd.
✅ Ga naar een website en kijk of de ontwerpers en ontwikkelaars HTML correct gebruiken. Kunt u een button vinden die een link zou moeten zijn? Tip: klik met de rechtermuisknop en kies 'View Page Source' in uw browser om de onderliggende code te bekijken.
### Maak een beschrijvende kophiërarchie
Gebruikers van schermlezers [zijn sterk afhankelijk van koppen](https://webaim.org/projects/screenreadersurvey8/#finding) om informatie te vinden en door een pagina te navigeren. Het schrijven van beschrijvende koptekst en het gebruik van semantische koptags zijn belangrijk voor het maken van een gemakkelijk navigeerbare site voor gebruikers van schermlezers.
### Gebruik goede visuele aanwijzingen
CSS biedt volledige controle over het uiterlijk van elk element op een pagina. U kunt tekstvakken zonder omtreklijn of hyperlinks zonder onderstreping maken. Helaas kan het verwijderen van die aanwijzingen het voor iemand die van hen afhankelijk is, uitdagender maken om het type controle te herkennen.
## Het belang van linktekst
Hyperlinks zijn essentieel voor het navigeren op internet. Als gevolg hiervan kunnen alle gebruikers door uw site navigeren door ervoor te zorgen dat een schermlezer links correct kan lezen.
### Schermlezers en links
Zoals u zou verwachten, lezen schermlezers linktekst op dezelfde manier als andere tekst op de pagina. Met dit in gedachten kan de onderstaande tekst volkomen acceptabel aanvoelen.
> De Dwergpinguïn, ook wel bekend als de sprookjespinguïn, is de kleinste pinguïn ter wereld. [Klik hier](https://nl.wikipedia.org/wiki/Dwergpingu%C3%AFn) voor meer informatie.
> De Dwergpinguïn, ook wel bekend als de sprookjespinguïn, is de kleinste pinguïn ter wereld. Bezoek https://nl.wikipedia.org/wiki/Dwergpingu%C3%AFn voor meer informatie.
> **OPMERKING** Zoals u gaat lezen, moet u **nooit** links maken die er als hierboven uitzien.
Onthoud dat schermlezers een andere interface zijn dan browsers met een andere set functies.
### Het probleem met het gebruik van de URL
Schermlezers lezen de tekst. Als er een URL in de tekst voorkomt, leest de schermlezer de URL. Over het algemeen geeft de URL geen zinvolle informatie over en kan deze vervelend klinken. Mogelijk heeft u dit ondervonden als uw telefoon ooit een sms-bericht met een URL hoorbaar heeft gelezen.
### Het probleem met "klik hier"
Schermlezers hebben ook de mogelijkheid om alleen de hyperlinks op een pagina te lezen, net zoals een ziende een pagina zou scannen op links. Als de linktekst altijd "klik hier" is, hoort de gebruiker alleen "klik hier, klik hier, klik hier, klik hier, klik hier, ..." Alle links zijn nu niet meer van elkaar te onderscheiden.
### Goede linktekst
Een goede linktekst beschrijft in het kort wat er aan de andere kant van de link staat. In het bovenstaande voorbeeld over Dwergpinguïns, is de link naar de Wikipedia-pagina over de soort. De zin *Dwergpinguïns* zou zorgen voor perfecte linktekst, omdat het duidelijk maakt wat iemand zal leren als ze op de link klikken - Dwergpinguïns.
> De [Dwergpinguïn](https://nl.wikipedia.org/wiki/Dwergpingu%C3%AFn), ook wel bekend als de sprookjespinguïn, is de kleinste pinguïn ter wereld.
✅ Surf een paar minuten op internet om pagina's te vinden die obscure koppelingsstrategieën gebruiken. Vergelijk ze met andere, beter gekoppelde sites. Wat leer je?
#### Aantekeningen bij zoekmachines
Als extra bonus om ervoor te zorgen dat uw site voor iedereen toegankelijk is, helpt u zoekmachines ook bij het navigeren op uw site. Zoekmachines gebruiken linktekst om de onderwerpen van pagina's te leren. Het gebruik van goede linkteksten helpt dus iedereen!
### ARIA
Stelt u de volgende pagina voor:
| Product | beschrijving | Volgorde |
| ------------ | ------------------ | ------------ |
| Widget | [beschrijving]('#') | [Volgorde]('#') |
| Super widget | [beschrijving]('#') | [Volgorde]('#') |
In dit voorbeeld is het zinvol om de tekst van de beschrijving en volgorde te dupliceren voor iemand die een browser gebruikt. Iemand die een schermlezer gebruikt, hoort echter alleen de woorden *beschrijving* en *volgorde* herhaald zonder context.
Om dit soort scenario's te ondersteunen, ondersteunt HTML een set attributen die bekend staan als [Accessible Rich Internet Applications (ARIA)](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA). Met deze attributen kunt u aanvullende informatie verstrekken aan schermlezers.
> **OPMERKING**: Zoals veel aspecten van HTML, kan de ondersteuning van browser en schermlezer variëren. De meeste mainline-clients ondersteunen echter ARIA-attributen.
U kunt `aria-label` gebruiken om de link te beschrijven als het formaat van de pagina dat niet toestaat. De beschrijving voor widget kan worden ingesteld als
``` html
<a href="#" aria-label="Widget description">beschrijving</a>
```
✅ Over het algemeen vervangt het gebruik van semantische opmaak zoals hierboven beschreven het gebruik van ARIA, maar soms is er geen semantisch equivalent voor verschillende HTML-widgets. Een goed voorbeeld is een boom. Er is geen HTML-equivalent voor een boomstructuur, dus identificeert u de generieke `<div>` voor dit element met een juiste rol en aria-waarden. De [MDN-documentatie over ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) bevat meer nuttige informatie.
```html
<h2 id="tree-label">File Viewer</h2>
<div role="tree" aria-labelledby="tree-label">
<div role="treeitem" aria-expanded="false" tabindex="0">Uploads</div>
</div>
```
## Afbeeldingen
Het spreekt voor zich dat schermlezers niet automatisch kunnen lezen wat er in een afbeelding staat. Ervoor zorgen dat afbeeldingen toegankelijk zijn, kost niet veel werk - daar gaat het bij het `alt`-attribuut om. Alle betekenisvolle afbeeldingen moeten een `alt` hebben om te beschrijven wat ze zijn.
Voor afbeeldingen die puur decoratief zijn, moet het `alt`-attribuut worden ingesteld op een lege tekenreeks: `alt=""`. Hiermee wordt voorkomen dat schermlezers de decoratieve afbeelding onnodig aankondigen.
✅ Zoals u zou verwachten, kunnen zoekmachines ook niet begrijpen wat er in een afbeelding staat. Ze gebruiken ook alt-tekst. Dus nogmaals, ervoor zorgen dat uw pagina toegankelijk is, levert extra bonussen op!
## Het toetsenbord
Sommige gebruikers kunnen geen muis of trackpad gebruiken, maar vertrouwen op toetsenbordinteracties om van het ene element naar het andere te gaan. Het is belangrijk dat uw website uw inhoud in een logische volgorde presenteert, zodat een toetsenbordgebruiker toegang heeft tot elk interactief element terwijl ze door een document bladeren. Als u uw webpagina's bouwt met semantische opmaak en CSS gebruikt om hun visuele lay-out op te maken, moet uw site toetsenbord-navigeerbaar zijn, maar het is belangrijk om dit aspect handmatig te testen. Meer informatie over [strategieën voor toetsenbordnavigatie](https://webaim.org/techniques/keyboard/).
✅ Ga naar een website en probeer er doorheen te navigeren met alleen uw toetsenbord. Wat werkt, wat werkt niet? Waarom?
## Overzicht
Een web dat voor sommigen toegankelijk is, is niet echt een 'world-wide web'. De beste manier om ervoor te zorgen dat de sites die u maakt, toegankelijk zijn, is door vanaf het begin de best practices voor toegankelijkheid op te nemen. Hoewel er extra stappen bij betrokken zijn, betekent het opnemen van deze vaardigheden in uw workflow dat alle pagina's die u maakt, toegankelijk zijn.
---
## 🚀 Uitdaging
Neem deze HTML en herschrijf deze zodat deze zo toegankelijk mogelijk is, gezien de strategieën die u hebt geleerd.
```html
<!DOCTYPE html>
<html>
<head>
<title>
Example
</title>
<link href='../assets/style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="site-header">
<p class="site-title">Turtle Ipsum</p>
<p class="site-subtitle">The World's Premier Turtle Fan Club</p>
</div>
<div class="main-nav">
<p class="nav-header">Resources</p>
<div class="nav-list">
<p class="nav-item nav-item-bull"><a href="https://www.youtube.com/watch?v=CMNry4PE93Y">"I like turtles"</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Turtle">Basic Turtle Info</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Turtles_(chocolate)">Chocolate Turtles</a></p>
</div>
</div>
<div class="main-content">
<div>
<p class="page-title">Welcome to Turtle Ipsum.
<a href="">Click here</a> to learn more.
</p>
<p class="article-text">
Turtle ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</p>
</div>
</div>
<div class="footer">
<div class="footer-section">
<span class="button">Sign up for turtle news</span>
</div><div class="footer-section">
<p class="nav-header footer-title">
Internal Pages
</p>
<div class="nav-list">
<p class="nav-item nav-item-bull"><a href="../">Index</a></p>
<p class="nav-item nav-item-bull"><a href="../semantic">Semantic Example</a></p>
</div>
</div>
<p class="footer-copyright">&copy; 2016 Instrument</span>
</div>
</body>
</html>
```
## Quiz na de lezing
[Quiz na de lezing](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/6)
## Beoordeling en zelfstudie
Veel regeringen hebben wetten met betrekking tot toegankelijkheidseisen. Lees de toegankelijkheidswetten van uw thuisland. Wat wordt er gedekt en wat niet? Een voorbeeld is [deze overheidswebsite](https://accessibility.blog.gov.uk/).
## Toewijzing
[Analyseer een niet-toegankelijke website](assignment.nl.md)
Credits: [Turtle Ipsum](https://github.com/Instrument/semantic-html-sample) door instrument

@ -0,0 +1,228 @@
# 创造无障碍网页
![All About Accessibility](/sketchnotes/webdev101-a11y.png)
> 涂鸦笔记作者:[Tomomi Imura](https://twitter.com/girlie_mac)
## 课前小测
[课前小测](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/5?loc=zh_cn)
> 互联网的力量存在于其普适性中,让包括残障人士在内的每个人都能访问互联网,是其中不可或缺的一方面。
>
> —— Timothy Berners-Lee W3C万维网联盟主席、万维网发明者
这段引言恰当地强调了创造无障碍网页的重要性。一个无法被所有人顺畅访问的应用按照定义来说是排他的,作为 Web 开发者我们应该始终将无障碍性牢记在心中。从一开始就关注到这一点,可以让你在确保每个人都能顺利访问你创造的页面这一方面做得很优秀。这节课中,你会了解到一些能帮助你确保你的网站资源无障碍的工具,也会学到该怎样将无障碍性牢记在心中。
## 相关工具
### 屏幕阅读器Screen readers
屏幕阅读器可以说是最知名的无障碍工具之一。
[屏幕阅读器](https://zh.wikipedia.org/wiki/%E8%9E%A2%E5%B9%95%E9%96%B1%E8%AE%80%E5%99%A8)在视力障碍者中被广泛使用。就像我们会花时间来确保浏览器正确地传达了我们想要分享的信息, 我们也必须要确保屏幕阅读器也可以达到同样的效果。
一般来说,屏幕阅读器会从上到下用语音阅读一个页面。如果你的页面全是文字,阅读器传达信息的方式和浏览器会是基本相似的。当然,网页几乎不会只有文字,还会包含链接、图像、颜色以及其他视觉组件。我们也必须得确保这些信息可以被屏幕阅读器正确阅读。
每一位 Web 开发者都需要去熟悉屏幕阅读器。正如上面强调的一样,这是你的用户会用到的一种客户端。就像你很熟悉浏览器的操作一样,你也应该去学习如何操作屏幕阅读器。幸运的是,多数操作系统都内置了屏幕阅读器。
一些浏览器也有内置的工具和扩展程序,可以读出文字甚至提供一些基本的导航功能,比如[这些以无障碍为目的的 Edge 浏览器工具](https://support.microsoft.com/zh-cn/microsoft-edge/microsoft-edge-%E4%B8%AD%E7%9A%84%E8%BE%85%E5%8A%A9%E5%8A%9F%E8%83%BD-4c696192-338e-9465-b2cd-bd9b698ad19a)。这些也是重要的无障碍工具,但是工作方式和屏幕阅读器非常不同,所以不该被错误地用来作为屏幕阅读器的测试工具。
✅ 试用一下屏幕阅读器和浏览器文本阅读器。在 Windows 系统中默认带有[讲述人](https://support.microsoft.com/zh-cn/windows/%E8%AE%B2%E8%BF%B0%E4%BA%BA%E5%AE%8C%E6%95%B4%E6%8C%87%E5%8D%97-e4397a0d-ef4f-b386-d8ae-c172f109bdb1),也可以安装 [JAWS](https://webaim.org/articles/jaws/) 和 [NVDA](https://www.nvaccess.org/about-nvda/)。在 macOS 和 iOS 中默认装有[旁白](https://support.apple.com/zh-cn/guide/voiceover/welcome/10)。
### 缩放Zoom
另一个视力障碍者常用的工具是缩放。最基本的缩放功能是静态缩放,通过 `Control + 加号(+` 或者降低屏幕分辨率达成。这样的缩放会导致整个页面尺寸被调整,所以使用[响应式设计responsive design](https://developer.mozilla.org/zh-CN/docs/Learn/CSS/CSS_layout/Responsive_Design)对于提高了缩放级别的情况下的用户体验非常重要。
另一类缩放需要借助特定的软件来放大屏幕上的部分区域,就像一个真正的放大镜一样。在 Windows 上内置了[放大镜](https://support.microsoft.com/zh-cn/windows/%E4%BD%BF%E7%94%A8%E6%94%BE%E5%A4%A7%E9%95%9C%E5%8F%AF%E4%BD%BF%E5%B1%8F%E5%B9%95%E4%B8%8A%E7%9A%84%E5%86%85%E5%AE%B9%E6%9B%B4%E6%98%93%E4%BA%8E%E6%9F%A5%E7%9C%8B-414948ba-8b1c-d3bd-8615-0e5e32204198),也可以使用 [ZoomText](https://www.freedomscientific.com/training/zoomtext/getting-started/) 这样有更多特性和更大用户群体的第三方软件。在 macOS 和 iOS 上则内置了[放大器](https://www.apple.com.cn/accessibility/vision/)
### 对比度检查器Contrast checkers
我们要谨慎地挑选网页上的配色,以照顾到色盲人群和难以区分低对比度颜色的用户的需要。
✅ 用类似 [WCAG's color checker](https://microsoftedge.microsoft.com/addons/detail/wcag-color-contrast-check/idahaggnlnekelhgplklhfpchbfdmkjp?hl=zh-CN) 这样的浏览器插件来检测一下你喜爱的网站的颜色使用情况。你学到了什么?
### Lighthouse
在浏览器开发者工具中,你可以找到 Lighthouse 工具。这个工具可以让你一睹一个网站的无障碍性(以及其他性能分析)。尽管并不建议完全依赖 Lighthouse但将 100% 满分作为一个基础将会很有用。
✅ 在你的浏览器开发者工具中找到 Lighthouse 栏,然后用它分析任何一个网站。你发现了什么?
## Designing for accessibility
无障碍性accessibility是一个相对比较大的主题为了帮助你更深入地了解这里许多你可以参考的资源。
- [Accessible U - 明尼苏达大学](https://accessibility.umn.edu/your-role/web-developers)
尽管我们没法在这里涵盖创建一个无障碍网站的方方面面,但下面还是提供了一些你会想要去实践的核心信条。从一开始就设计一个无障碍页面**总是**比回过头来让一个已经存在的页面变得无障碍会更容易。
## 不错的展示原则
### 使用安全色色板
每个人看待世界的方式都不尽相同,当然也包括颜色。当你为你的站点选择一套配色时,应该确保其对所有人都是无障碍的。这里有一个非常棒的[生成安全色色板的工具](http://colorsafe.co/)。
✅ 举出一个配色非常糟糕的网站的例子。你认为它糟糕在哪?
### 正确使用 HTML
使用 CSS 和 JavaScript 有能力让任何元素看起来在控制效果上是任何一种类型的元素。比如 `<span>` 可以被用来创建出一个 `<button>`,而 `<b>` 则可能会被弄成一个超链接。尽管有人可能认为这样会更加容易调整样式,但是它不会传达任何有效信息给屏幕阅读器。请使用合适的 HTML 来建立对于页面的控制效果,比如你想要一个超链接,请使用 `<a>` 标签。用正确的 HTML 来实现正确的控制效果,这就叫做实践了“语义化 HTML”Semantic HTML
✅ 去任意一个网站看看设计师和开发者是否合理使用了 HTML。你能不能找出一个本该是链接的按钮提示在浏览器中右键点击并且选择“查看网页源代码”来查看底层代码译注此处使用“检查”/“审查元素”来观察或许会更加合适)。
### 建立描述性的标题层级
屏幕阅读器使用者为了寻找信息和在页面中导航,会[非常依赖页面中的标题](https://webaim.org/projects/screenreadersurvey8/#finding)。使用描述性的标题内容和语义化的标题标签,对于创建一个对屏幕阅读器使用者友好的网站是非常重要的。
### 使用良好的视觉线索
CSS 让你可以完全随意地控制页面中任何元素的外观。你可以创建一个没有轮廓的文本框或者一个没有下划线的超链接。但不幸的是,移除这些视觉线索会让一些习惯依靠这些线索的使用者难以认出它们的控制功能。
## 链接文本的重要性
对于网页导航来说,超链接非常关键。因此,确保屏幕阅读器可以准确阅读链接才能保证所有用户都可以顺利地在你的网站导航。
### 屏幕阅读器与链接
可想而知,屏幕阅读器会像阅读页面中其他文本一样阅读链接的文本。将这点牢记在心后,可以看看下面两种看起来似乎还能接受的写法。
> 小蓝企鹅,有时也被称作仙企鹅,是世界上最小的企鹅。[点击这里](https://zh.wikipedia.org/wiki/%E5%B0%8F%E8%97%8D%E4%BC%81%E9%B5%9D)来查看更多信息。
> 小蓝企鹅,有时也被称作仙企鹅,是世界上最小的企鹅。访问 https://zh.wikipedia.org/wiki/%E5%B0%8F%E8%97%8D%E4%BC%81%E9%B5%9D 来查看更多信息。
> **注意** 下文即将提到,你应该 **避免** 使用上面这两种写法。
记住,屏幕阅读器和浏览器功能上有一些差异,是不同的交互媒介。
### 使用 URL 的问题
屏幕阅读器会阅读文本,如果 URL 出现在了文本里,屏幕阅读器就会直接读出这段 URL。一般来说URL 直接传递的信息都意义不大,而且听起来会很吵。如果你曾经在手机中将一段包含 URL 的文字用语音播放出来,就可能有类似体会。
### 使用“点击这里”的问题
屏幕阅读器也有只阅读页面中超链接的功能,就仿佛一个有视力的人扫视页面来找到所有链接一样。如果所有的链接文本都是“点击这里”,用户听到的就会一直是“点击这里,点击这里,点击这里,点击这里,点击这里……”,完全无法区分各个链接。
### 优秀的链接文本
优秀的链接文本会简要地描述链接另一侧是什么。在上面谈论小蓝企鹅的例子中,链接到的是关于这个物种的维基百科页面。使用*小蓝企鹅*作为链接文本将会非常合适,因为它能清楚地告诉人们如果他们点击了这个链接会了解到什么 —— 小蓝企鹅。
> [小蓝企鹅](https://zh.wikipedia.org/wiki/%E5%B0%8F%E8%97%8D%E4%BC%81%E9%B5%9D),有时也被称作仙企鹅,是世界上最小的企鹅。
✅ 上网随便逛几分钟,找一找使用了难以理解的链接策略的网页。对比一下其他有更好的链接的网站,你有何体会?
#### 关于搜索引擎
保证你的网站对所有人都无障碍还能带来一个额外的好处:可以帮助搜索引擎导航你的网站。搜索引擎会使用链接文本来了解页面的主题,所以使用好的链接文本其实利人利己!
### ARIA
想象一个下面这样的网页:
| 产品 | 详情 | 预订 |
| ------------ | ------------------ | ------------ |
| 小玩意 | [详情]('#') | [预订]('#') |
| 超棒的小玩意 | [详情]('#') | [预订]('#') |
在这个例子中,复制“详情”和“预订”这两个文本对于使用浏览器的用户来说是没有理解障碍的。然而,使用屏幕阅读器的用户则只会听到对 *详情**预订* 这两个词的两次毫无上下文的复读。
为了处理这类情况HTML 支持一些被称为 [Accessible Rich Internet Applications (ARIA)](https://developer.mozilla.org/zh-CN/docs/Web/Accessibility/ARIA) 的属性。这些属性让你可以为屏幕阅读提供一些额外的信息。
> **注意**:正如 HTML 的其他方面一样,浏览器和屏幕阅读器对 ARIA 的支持情况可能会不同,但是多数主流客户端都是支持 ARIA 属性的。
当页面格式不允许你直接用文本描述链接时,你可以使用 `aria-label` 属性来对链接进行描述。对于一个小玩意的详情描述可以被设置为:
``` html
<a href="#" aria-label="小玩意的详情">详情</a>
```
✅ 一般来说,使用此前提到的语义化标签会比使用 ARIA 更好,但是有时确实存在没法找到合适的语义标签来描述一些 HTML 元素。比如“树”,没有和“树”语义等价的 HTML 标签,所以你可以给这个元素选用一般的 `<div>` 标签,然后加上合理的 role 和 aria 属性值。[MDN ARIA 文档](https://developer.mozilla.org/zh-CN/docs/Web/Accessibility/ARIA)有更多有用的相关信息。
```html
<h2 id="tree-label">文件查看器</h2>
<div role="tree" aria-labelledby="tree-label">
<div role="treeitem" aria-expanded="false" tabindex="0">上传</div>
</div>
```
## 图像
毫无疑问,屏幕阅读器是没法自动阅读图像内容的,但是让图像变得无障碍并不会很麻烦 —— 这正是 `alt` 属性所做的事。所有有意义的图像都应该有一个 `alt` 属性来描述它们的内容是什么。纯装饰性的图像应该有一个被设为空字符串的 `alt` 属性:`alt=""`,这样可以防止屏幕阅读器画蛇添足地描述这些装饰性图像。
✅ 没错,搜索引擎也无法理解图片的内容,它们也会使用 alt 属性中的文本。这又一次证明,确保你的页面无障碍可以带来额外的好处!
## 键盘
一些用户没法使用鼠标或者触控板,而是只能依赖键盘交互来从一个元素切换到下一个元素。在你的网站上以有逻辑的顺序来展示内容是很重要的,这样一来键盘用户可以在往下浏览页面时访问到每一个可交互元素。如果你用你语义化标签来构建页面并且用 CSS 来控制它们的视觉外观,你的页面就应该会是可用键盘导航的,但是最好还是手动测试一遍。可在[键盘导航策略](https://webaim.org/techniques/keyboard/)了解更多关于这方面的内容。
✅ 前往任意一个网站然后尝试只使用你的键盘来导航。哪些可以正常使用?哪些不可以?为什么?
## 总结
只有部分人才能顺利访问的网页算不上真正的万维网world-wide web。确保你创造的网站无障碍地最好方式就是从一开始就贯彻无障碍的最佳实践。尽管这可能会引入额外的步骤但现在就将这些技术包含在你的工作流程中将意味着你创造的所有页面都会是无障碍的。
---
## 🚀 挑战
利用你学到的策略,尽可能将下方的 HTML 代码重写为无障碍的。
```html
<!DOCTYPE html>
<html>
<head>
<title>
Example
</title>
<link href='../assets/style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="site-header">
<p class="site-title">Turtle Ipsum</p>
<p class="site-subtitle">The World's Premier Turtle Fan Club</p>
</div>
<div class="main-nav">
<p class="nav-header">Resources</p>
<div class="nav-list">
<p class="nav-item nav-item-bull"><a href="https://www.youtube.com/watch?v=CMNry4PE93Y">"I like turtles"</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Turtle">Basic Turtle Info</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Turtles_(chocolate)">Chocolate Turtles</a></p>
</div>
</div>
<div class="main-content">
<div>
<p class="page-title">Welcome to Turtle Ipsum.
<a href="">Click here</a> to learn more.
</p>
<p class="article-text">
Turtle ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</p>
</div>
</div>
<div class="footer">
<div class="footer-section">
<span class="button">Sign up for turtle news</span>
</div><div class="footer-section">
<p class="nav-header footer-title">
Internal Pages
</p>
<div class="nav-list">
<p class="nav-item nav-item-bull"><a href="../">Index</a></p>
<p class="nav-item nav-item-bull"><a href="../semantic">Semantic Example</a></p>
</div>
</div>
<p class="footer-copyright">&copy; 2016 Instrument</span>
</div>
</body>
</html>
```
## 课后小测
[课后小测](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/6?loc=zh_cn)
## 复习 & 自学
许多政府有关于无障碍要求的法律,阅读一下你的国家与无障碍相关的法律。它涉及了哪些方面,又有哪些方面没有涉及?[这个政府网站](https://accessibility.blog.gov.uk/)是一个例子。
## 作业
[分析一个非无障碍网站](assignment.zh-cn.md)
参考:[Turtle Ipsum](https://github.com/Instrument/semantic-html-sample)作者Instrument

@ -0,0 +1,231 @@
# 建立無障礙網頁
![關於網頁親和力](/sketchnotes/webdev101-a11y.png)
> 由 [Tomomi Imura](https://twitter.com/girlie_mac) 繪製
## 課前測驗
[課前測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/5?loc=zh_tw)
> 網路的強大在於它的普遍性。無論用戶是否有殘疾,讓大家無差別地使用網路是必要的。
>
> The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.
>
> \- Tim Berners-Lee 爵士 ── 全球資訊網協會總監暨網際網路創立者
這段話完美地詮釋建立無障礙網頁的重要性。應用程式若無法服務所有人是建立在排他性設計。身為一位網頁開發員,我們需要時刻警惕著網頁親和力。從此時開始,你接下來創建的網頁要能服務給任何人。在這堂課中,你會學習開發無障礙網頁相關的工具與觀念。
## 相關工具
### 螢幕報讀器 (Screen readers)
螢幕報讀器可說是最知名的無障礙工具之一。
[螢幕報讀器](https://zh.wikipedia.org/wiki/%E8%9E%A2%E5%B9%95%E9%96%B1%E8%AE%80%E5%99%A8)已被廣泛地幫助視覺障礙者。就像我們花了不少時間確保瀏覽器能呈現網頁內容,我們也要確保螢幕報讀器能完整地實現相同的工作。
基本上,螢幕報讀器會一行一行地報讀網頁的內容。若網頁都是以文字建構而成,那螢幕報讀器就能達到與瀏覽器相同的功效。當然,網頁不可能只有文字:裡面可能會有連結、圖像、顏色或是其他視覺物件。我們必須確保螢幕報讀器也能呈現出上述物件。
任何一位網頁開發者需要熟悉螢幕報讀器。它們是用戶的好幫手,就像你的瀏覽器一樣,你需要學習螢幕報讀器是如何運作的。幸運的是,它們都內建在大部分的作業系統當中。
有些瀏覽器內建相關工具與擴充插件,報讀出文字甚至是可互動物件:例如[這些以網頁親和力為目標的 Edge 瀏覽器工具](https://support.microsoft.com/zh-tw/microsoft-edge/microsoft-edge-%E7%9A%84%E5%8D%94%E5%8A%A9%E5%B7%A5%E5%85%B7%E5%8A%9F%E8%83%BD-4c696192-338e-9465-b2cd-bd9b698ad19a)。 它們是重要的輔助工具,或許與螢幕報讀器有所差異,但基本上能測試螢幕報讀器的基本功能。
✅ 嘗試使用螢幕報讀器或瀏覽器朗讀工具。 在 Windows 中,[Narrator](https://support.microsoft.com/zh-tw/windows/%E5%AE%8C%E6%95%B4%E7%9A%84%E6%9C%97%E8%AE%80%E7%A8%8B%E5%BC%8F%E6%8C%87%E5%8D%97-e4397a0d-ef4f-b386-d8ae-c172f109bdb1)內建在系統中,使用者也可以選擇[JAWS](https://webaim.org/articles/jaws/)與[NVDA](https://www.nvaccess.org/about-nvda/)等額外安裝程式。 macOS 與 iOS 平台上則內建[VoiceOver](https://support.apple.com/guide/voiceover/welcome/10)。
### 放大器
另一項為視覺障礙者提供的輔助程式為放大器。最常見的定點放大功能,可以藉由 `Control + 加號(+)` 或降低螢幕解析度來完成。這個步驟會重新縮放整個網頁,確保網頁的[互動式設計](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Responsive_Design)是縮放頁面重要的一環。
其他放大功能會專注在小部分的區域上,這些額外軟體提供類似於實體放大器的功能。 Windows 內建[放大器](https://support.microsoft.com/zh-tw/windows/%E4%BD%BF%E7%94%A8%E6%94%BE%E5%A4%A7%E9%8F%A1%E4%BB%A5%E8%AE%93%E8%9E%A2%E5%B9%95%E4%B8%8A%E7%9A%84%E5%85%A7%E5%AE%B9%E6%9B%B4%E5%AE%B9%E6%98%93%E7%9C%8B%E5%88%B0-414948ba-8b1c-d3bd-8615-0e5e32204198)功能;第三方程式[ZoomText](https://www.freedomscientific.com/training/zoomtext/getting-started/)則受到廣泛用戶的使用。 macOS 與 iOS 內建[Zoom](https://www.apple.com/accessibility/mac/vision/)軟體。
### 對比度檢查器
我們必須謹慎地挑選網頁的顏色對比度,讓色盲人士或低視能障礙者有辦法閱讀文章。
✅ 利用相關的瀏覽器擴充插件來測試看看你所喜愛的網頁,例如[WCAG's color checker](https://microsoftedge.microsoft.com/addons/detail/wcag-color-contrast-check/idahaggnlnekelhgplklhfpchbfdmkjp?hl=zh-tw)。 你學到了什麼?
### Lighthouse
在瀏覽器的開發者工具中,你能找到一款工具名為 Lighthouse。這項工具可以有效的確認網頁親和力。這邊不強制網頁都要經過 Lighthouse 審核,但 100% 的分數是網頁完美的基礎。
✅ 在你的瀏覽器開發工具中找尋 Lighthouse ,對任何網頁做分析。 你發現了什麼?
## 提升網頁親和力
網頁親和力是項相對龐大的主體。要尋求幫助,網路上有許多資源可以參考。
- [Accessible U - 明尼蘇達大學](https://accessibility.umn.edu/your-role/web-developers)
我們無法在此說明建立無障礙網頁的所有重點,但下列是開發時重要的核心觀念。從零開始就留意網頁親和力**一定會比**從完成的網頁來增進網頁親和力來的容易。
## 良好的呈現方式
### 安全的配色
每個人的觀點都有所不同,包含觀看顏色。如何選擇配色也是網頁親和力的課題之一。下列是一款實用的[安全配色生產工具](http://colorsafe.co/).
✅ 舉出在配色上有問題的一個網頁,告訴大家為什麼?
### 使用合理的 HTML 語法
在 CSS 與 JavaScript 的支援下,我們無法判斷網頁物件的控制目的。 好比 `<span>` 也可以建立 `<button>` `<b>` 可以代表超連結。 在造型變化上或許較為容易,但可能會對螢幕報讀器產生混淆。我們必須確保對應的控制有相同的標籤,例如超連結只使用 `<a>`。這才能完整的表現 HTML 的語義化。
✅ 去任何一個網頁分析開發員與設計員是否使用正確的 HTML 語法。 你能找到語法將連結取代成按鈕嗎? 小提示:在瀏覽器中點擊「右鍵」 > 「檢視網頁原始碼」來確認程式碼。
### 建立分級的描述性標題的
螢幕報讀器使用者[非常仰賴文字標題](https://webaim.org/projects/screenreadersurvey8/#finding),確認並查詢網頁資訊。使用描述性標題並有層次的標籤分別得以創建出較易閱讀的網頁。
### 使用合理的視覺指引
CSS 提供完整的網頁造型控制,你可以讓文字框框線隱藏或是讓超連結去除底線。然而去除這些視覺指引會造成視覺障礙者閱讀上的困擾,難以辨別它們原本的功能性。
## 連結文字的重要性
超連結是網頁中重點物件。請確保螢幕報讀器能正確的辨識網頁中的超連結。
### 螢幕報讀器處理連結
可想而知,螢幕報讀器對於連結與文字的朗讀方式是相同的。因此,判斷下列文章例子,哪個對於網頁親和力上較為合理?
> 小藍企鵝,又稱做仙企鵝,是世界上最小的企鵝。[點擊這裡](https://zh.wikipedia.org/zh-tw/%E5%B0%8F%E8%97%8D%E4%BC%81%E9%B5%9D)了解更多資訊。
> 小藍企鵝,又稱做仙企鵝,是世界上最小的企鵝。造訪 https://zh.wikipedia.org/zh-tw/%E5%B0%8F%E8%97%8D%E4%BC%81%E9%B5%9D 了解更多資訊。
> **注意** 讀完之後,請盡量**避免**上方的連結例子。
記得,螢幕報讀器處理物件的方式會與瀏覽器有所不同。
### 使用 URL 的問題
螢幕報讀器會朗讀文字。如果 URL 出現在文章中,它也會被裝置朗讀。綜觀來說,朗讀 URL 不含有任何意義,而且聽來不悅耳。你可能曾在手機上聽過含有網址的文章朗讀。
### 使用「點擊這裡」的問題
螢幕報讀器有能力去處理超連結文字,就像我們尋找網頁中的連結一樣。想像所有的超連結文字都表示成「點擊這裡」,用戶就會重複聽到「點擊這裡!點擊這裡!點擊這裡!點擊這裡......」,會造成別人的困擾。
### 合理的連結文字
合理的連結文字為連結與文字找到了平衡。像上方例子中的小藍企鵝,連結是導向維基百科的物種頁面。文字*小藍企鵝*就會是完美的連結文字,讓用戶了解點擊後會取得關於小藍企鵝的相關資訊。
> [小藍企鵝](https://zh.wikipedia.org/zh-tw/%E5%B0%8F%E8%97%8D%E4%BC%81%E9%B5%9D),又稱做仙企鵝,是世界上最小的企鵝。
✅ 花點時間逛逛網頁,觀察它們如何設定連結的導向。比較較合適的連結文字,你學到了什麼?
#### 關於搜尋引擎
網頁中的搜尋引擎對網頁親和力有加分的效果,搜尋引擎也能從連結找到你的網頁,了解網頁的主題。所以連結文字對大家都有幫助!
### ARIA
想像下方的網頁:
| 產品 | 描述 | 數量 |
| ------------ | ----------- | ----------- |
| 物品 | [描述]('#') | [數量]('#') |
| 超優物品 | [描述]('#') | [數量]('#') |
在這項舉例中,瀏覽器用戶可以清楚地辨別重複性的「描述」與「數量」;但對於螢幕報讀器用戶而言,他們只能重複地聽取*「描述」與「數量」*這兩個單詞。
為了處理這種情況HTML 提供一套屬性名為[Accessible Rich Internet Applications (ARIA)](https://developer.mozilla.org/docs/Web/Accessibility/ARIA)。它能為螢幕報讀器附加額外的朗讀資訊。
> **注意** 就如 HTML 的各式物件,瀏覽器與螢幕報讀器能支援的項目也不盡相同。然而,客群主體基本上都支援 ARIA 屬性。
若網頁不支援部分格式語法,你可以使用 `aria-label` 來描述連結。就如下方物件被標註上 "Widget description" 的標籤。
``` html
<a href="#" aria-label="Widget description">description</a>
```
✅ 總體而言,使用語義化標籤得以取代 ARIA 功能,但是這些標籤無法全面性地覆蓋 HTML 的各式物件。樹(Tree)就是一種例子。沒有 HTML 物件能處理一棵樹,所以你可以在 `<div>` 元素中加上 aria 數值。[關於 ARIA 的 MDN 技術文件](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA)說明許多有用的資訊。
```html
<h2 id="tree-label">File Viewer</h2>
<div role="tree" aria-labelledby="tree-label">
<div role="treeitem" aria-expanded="false" tabindex="0">Uploads</div>
</div>
```
## 圖片
螢幕報讀器用戶無法直接的了解圖片內容。為了確保圖片也能服務給視覺障礙者,這就是 `alt` 屬性存在的目的。所有重要的圖片都需要有 `alt` 描述圖片的內容。
裝飾性圖片的 `alt` 欄位就需要留空字串:`alt=""`。 這樣能避免螢幕報讀器朗讀不必要的裝飾性圖片敘述。
✅ 你可能會猜到,搜尋引擎也有可能無法辨別圖片。它們也是使用 alt 敘述。因此,無障礙網頁有許多加分要素!
## 鍵盤輸入
有些用戶無法使用滑鼠或觸控板,他們需要使用鍵盤中的 "tab" 鍵來切換網頁元素讓網頁物件能順序性地排列與互動就很重要。如果網頁有語義化標籤並以CSS造型化視覺畫面網頁基本上就能以鍵盤來切換當然手動測試還是必要的。了解更多關於[鍵盤調查的策略](https://webaim.org/techniques/keyboard/)。
✅ 前往任何一個網頁,試著只以鍵盤瀏覽網頁。哪些能成功運作,你又遭遇了哪些困難? 你有辦法解釋嗎?
## 結論
能連上網頁並不是網際網路的真諦。從現在起確保網頁能以無障礙的方式呈現。雖然還有很多未被提及的開發資訊,熟習你知道的無障礙開發知識一定會對網頁有所幫助。
---
## 🚀 挑戰
看看下列的 HTML 程式碼。利用你所學到的知識,試著增進它的網頁親和力。
```html
<!DOCTYPE html>
<html>
<head>
<title>
Example
</title>
<link href='../assets/style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="site-header">
<p class="site-title">Turtle Ipsum</p>
<p class="site-subtitle">The World's Premier Turtle Fan Club</p>
</div>
<div class="main-nav">
<p class="nav-header">Resources</p>
<div class="nav-list">
<p class="nav-item nav-item-bull"><a href="https://www.youtube.com/watch?v=CMNry4PE93Y">"I like turtles"</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Turtle">Basic Turtle Info</a></p>
<p class="nav-item nav-item-bull"><a href="https://en.wikipedia.org/wiki/Turtles_(chocolate)">Chocolate Turtles</a></p>
</div>
</div>
<div class="main-content">
<div>
<p class="page-title">Welcome to Turtle Ipsum.
<a href="">Click here</a> to learn more.
</p>
<p class="article-text">
Turtle ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</p>
</div>
</div>
<div class="footer">
<div class="footer-section">
<span class="button">Sign up for turtle news</span>
</div><div class="footer-section">
<p class="nav-header footer-title">
Internal Pages
</p>
<div class="nav-list">
<p class="nav-item nav-item-bull"><a href="../">Index</a></p>
<p class="nav-item nav-item-bull"><a href="../semantic">Semantic Example</a></p>
</div>
</div>
<p class="footer-copyright">&copy; 2016 Instrument</span>
</div>
</body>
</html>
```
## 課後測驗
[課後測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/6?loc=zh_tw)
## 複習與自學
許多政府機關立法要求無障礙需求。查詢你的國家是否有這些法規。它們涉及了那些,那些又沒包含在其中? 看看[英國政府機關網頁](https://accessibility.blog.gov.uk/)的例子。
## 作業
[分析一個非無障礙網頁](assignment.zh-tw.md)
參考出處: [Turtle Ipsum](https://github.com/Instrument/semantic-html-sample)

@ -2,11 +2,11 @@
## Instrucciones
Identifique un sitio web que crea que NO es accesible y cree un plan de acción para mejorar su accesibilidad. Su primera tarea sería identificar este sitio, detallar las formas en que cree que es inaccesible sin usar herramientas analíticas y luego someterlo a un análisis Lighthouse. Tome los resultados de este análisis y describa un plan detallado con un mínimo de diez puntos que muestre cómo se podría mejorar el sitio.
Identifica un sitio web que creas que NO es accesible y crea un plan de acción para mejorar su accesibilidad. Tu primer tarea será identificar este sitio, detallar las formas en que crees que es inaccesible sin usar herramientas analíticas y luego someterlo a un análisis Lighthouse. Toma los resultados de este análisis y describe un plan detallado con un mínimo de diez puntos que muestre cómo se podría mejorar el sitio.
## Rúbrica
| Criterios | Ejemplar | Adecuada | Necesita mejorar |
| Criterios | Ejemplar | Adecuado | Necesita mejorar |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | --------------------------- |
| informe del estudiante | incluye párrafos sobre cómo el sitio es inadecuado, el informe Lighthouse capturado como un pdf, una lista de diez puntos para mejorar, con detalles sobre cómo mejorarlo | falta el 20% de lo requerido | falta el 50% de lo requerido
|

@ -0,0 +1,11 @@
# Analyseer een niet-toegankelijke website
## Instructies
Identificeer een website waarvan u denkt dat deze NIET toegankelijk is, en maak een actieplan om de toegankelijkheid ervan te verbeteren. Uw eerste taak zou zijn om deze site te identificeren, de manieren te beschrijven waarop u denkt dat deze ontoegankelijk is zonder analytische tools te gebruiken, en deze vervolgens door een Lighthouse-analyse te laten gaan. Neem de resultaten van deze analyse en maak een gedetailleerd plan met minimaal tien punten waaruit blijkt hoe de site kan worden verbeterd.
## Rubriek
| Criteria | Voorbeeldig | Voldoende | Moet worden verbeterd |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | --------------------------- |
| studentenrapport | bevat paragrafen over hoe de site ontoereikend is, het Lighthouse-rapport vastgelegd als pdf, een lijst met tien punten die verbeterd kunnen worden, met details over hoe deze te verbeteren | ontbreekt 20% van de vereiste | ontbreekt 50% van de vereiste |

@ -0,0 +1,11 @@
# 分析一个非无障碍网站
## 说明
找到一个你认为无障碍性做得不好的网站,制定一个提升其无障碍性的计划表。你的第一个任务是找到这样一个网站,并在不借助分析工具的前提下详细指出你认为它无障碍做得不好的方面,然后再使用 Lighthouse 分析工具来分析它。借助分析的结果,制定一个包含至少十点的改进该网站的详细计划。
## 评价表
| 标准 | 优秀 | 良好 | 尚可进步 |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | --------------------------- |
| 书面报告 | 解释了这个网站做得不好的地方,将 Lighthouse 报告打印为 PDF 文件,至少十点可改进之处,每点详细说明了改进策略 | 缺少上述 20% 内容 | 缺少上述 50% 内容 |

@ -0,0 +1,11 @@
# 分析一個非無障礙網頁
## 說明
辨別一個你認為對視覺障礙者不友善的網頁,列出網頁改進的策略。你需要先發掘各個網頁,不使用分析工具的情況下判斷網頁的親和力,再套用到 Lighthouse 審核工具。將網頁的審核結果轉化成至少十點的改進計畫。
## 學習評量
| 作業內容 | 優良 | 普通 | 待改進 |
| -------- | ----------------------------------------------------------------------------------- | --------------- | --------------- |
| 書面報告 | 文章解釋為何網頁需要被改進,將 Lighthouse 結果轉成 pdf 檔,列出十點詳細的改進計畫。 | 缺少 20% 的內容 | 缺少 50% 的內容 |

@ -0,0 +1,17 @@
# Premiers pas avec le développement Web
Dans cette section du programme, vous serez initié à des concepts non basés sur des projets importants pour devenir un développeur professionnel.
### theme
1. [Introduction aux langages de programmation et aux outils du métier](1-intro-to-programming-languages/README.md)
2. [Bases de GitHub](2-github-basics/README.md)
3. [Bases de l'accessibilité](3-accessibility/README.md)
### Crédits
Bases de l'accessibilité a été écrit avec ♥ par [Christopher Harrison](https://twitter.com/geektrainer)
L'introduction à GitHub a été écrite avec ♥ par [Floor Drees](https://twitter.com/floordrees)
L'introduction aux langages de programmation et aux outils du métier a été écrite avec ♥ par [Jasmine Greenaway](https://twitter.com/paladique)

@ -0,0 +1,17 @@
# Aan de slag met webontwikkeling
In dit deel van het curriculum maakt u kennis met niet-projectgebaseerde concepten die belangrijk zijn om een professionele ontwikkelaar te worden.
### Onderwerpen
1. [Inleiding tot programmeertalen en tools van het vak](../1-intro-to-programming-languages/translations/README.nl.md)
2. [Basisprincipes van GitHub](../2-github-basics/translations/README.nl.md)
3. [Basisprincipes van toegankelijkheid](../3-accessibility/translations/README.nl.md)
### Credits
Basisprincipes van toegankelijkheid is geschreven met ♥ door [Christopher Harrison](https://twitter.com/geektrainer)
Inleiding tot GitHub is geschreven met ♥ door [Floor Drees](https://twitter.com/floordrees)
Inleiding tot programmeertalen en tools van het vak is geschreven met ♥ door [Jasmine Greenaway](https://twitter.com/paladique)

@ -0,0 +1,17 @@
# 开始 Web 开发
在课程的这一部分,我们会通过不编写代码的方式介绍一些概念,这些概念对于成为一位专业的开发者非常重要。
### 主题
1. [编程语言概述与工具介绍](../1-intro-to-programming-languages/translations/README.zh-cn.md)
2. [GitHub 基础知识](../2-github-basics/translations/README.zh-cn.md)
3. [无障碍性基础知识](../3-accessibility/translations/README.zh-cn.md)
### 参考
无障碍性基础知识由 [Christopher Harrison](https://twitter.com/geektrainer) 用 ♥️ 编写
GitHub 基础知识由 [Floor Drees](https://twitter.com/floordrees) 用 ♥️ 编写
编程语言概述与工具介绍由 [Jasmine Greenaway](https://twitter.com/paladique) 用 ♥️ 编写

@ -0,0 +1,17 @@
# 網頁開發入門
這段課程會說明重要的程式開發觀念,不會以程式碼為導向,讓你成為出色的開發人員。
### 主題
1. [程式語言概論與必備工具](../1-intro-to-programming-languages/translations/README.zh-tw.md)
2. [GitHub 簡介](../2-github-basics/translations/README.zh-tw.md)
3. [建立無障礙網頁](../3-accessibility/translations/README.zh-tw.md)
### 參與人員
文章「無障礙網頁」是由 [Christopher Harrison](https://twitter.com/geektrainer) 用滿滿的 ♥️ 來編寫。
文章「GitHub 簡介」是由 [Floor Drees](https://twitter.com/floordrees) 用滿滿的 ♥️ 來編寫。
文章「建立無障礙網頁」是由 [Jasmine Greenaway](https://twitter.com/paladique) 用滿滿的 ♥️ 來編寫。

@ -1,6 +1,6 @@
# JavaScript Basics: Data Types
![JavaScript Basics - Data types](images/webdev101-js-datatypes.png)
![JavaScript Basics - Data types](/sketchnotes/webdev101-js-datatypes.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz
@ -176,7 +176,7 @@ Booleans can be only two values: `true` or `false`. Booleans can help make decis
- `let myTrueBool = true`
- `let myFalseBool = false`
✅ A variable can be considered 'truthy' if it evaluates to a boolean `true`. Interestingly, in JavaScript, [all values are truthy unless defined as falsy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).
✅ A variable can be considered 'truthy' if it evaluates to a boolean `true`. Interestingly, in JavaScript, [all values are truthy unless defined as falsy](https://developer.mozilla.org/docs/Glossary/Truthy).
---

@ -178,7 +178,7 @@ Boolesche Werte können nur zwei Werte sein: `true` oder `false`. Boolesche Wert
- `let myTrueBool = true`
- `let myFalseBool = false`
✅ Eine Variable kann als "wahr" betrachtet werden, wenn sie als boolescher Wert "wahr" ausgewertet wird. Interessanterweise sind in JavaScript [alle Werte wahr, sofern sie nicht als falsch definiert sind](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).
✅ Eine Variable kann als "wahr" betrachtet werden, wenn sie als boolescher Wert "wahr" ausgewertet wird. Interessanterweise sind in JavaScript [alle Werte wahr, sofern sie nicht als falsch definiert sind](https://developer.mozilla.org/docs/Glossary/Truthy).
--- ---.

@ -1,8 +1,11 @@
# Conceptos básicos de JavaScript: tipos de datos
![JavaScript Basics - Data types](/sketchnotes/webdev101-js-datatypes.png)
> Sketchnote por [Tomomi Imura](https://twitter.com/girlie_mac)
[![Tipos de datos en JavaScript](https://img.youtube.com/vi/rEHV3fFMfn0/0.jpg)](https://youtube.com/watch?v=rEHV3fFMfn0 "Tipos de datos en JavaScript")
## [Pre-lecture prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/7)
## [Pre-lectura prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/7)
Esta lección cubre los conceptos básicos de JavaScript, el lenguaje que proporciona interactividad en la web.
@ -21,7 +24,7 @@ Crear y **declarar** una variable tiene la siguiente sintaxis **[keyword] [name]
### Tarea - trabajar con variables
1. **Declare una variable**. Declaremos una variable usando la palabra clave `let`:
1. **Declara una variable**. Declaremos una variable usando la palabra clave `let`:
```javascript
let myVariable;
@ -39,7 +42,7 @@ Crear y **declarar** una variable tiene la siguiente sintaxis **[keyword] [name]
`myVariable` ahora se ha *inicializado* con el valor 123.
1. **Refactor**. Reemplace su código con la siguiente declaración.
1. **Refactorizar código**. Reemplace su código con la siguiente declaración.
```javascript
let myVariable = 123;
@ -66,9 +69,9 @@ La declaración e inicialización de una constante sigue los mismos conceptos qu
const MY_VARIABLE = 123;
```
CLas constantes son similares a las variables, con dos excepciones:
Las constantes son similares a las variables, con dos excepciones:
- **Debe tener un valor**. Las constantes deben inicializarse o se producirá un error al ejecutar el código.
- **Deben tener un valor**. Las constantes deben inicializarse o se producirá un error al ejecutar el código.
- **La referencia no se puede cambiar**. La referencia de una constante no se puede cambiar una vez inicializada, o se producirá un error al ejecutar el código. Veamos dos ejemplos:
- **Valor simple**. NO se permite lo siguiente:
@ -78,11 +81,11 @@ CLas constantes son similares a las variables, con dos excepciones:
PI = 4; // no permitido
```
- **La referencia de objeto está protegida**. NO se permite lo siguiente.
- **La referencia del objeto está protegida**. NO se permite lo siguiente.
```javascript
const obj = { a: 3 };
obj = { b: 5 } // o permitido
obj = { b: 5 } // no permitido
```
- **El valor del objeto no está protegido**. Se permite lo siguiente:
@ -94,7 +97,7 @@ CLas constantes son similares a las variables, con dos excepciones:
Arriba está cambiando el valor del objeto pero no la referencia en sí, lo que lo permite.
> Tenga en cuenta que una `const` significa que la referencia está protegida contra la reasignación. Sin embargo, el valor no es _immutable_ y puede cambiar, especialmente si es una construcción compleja como un objeto.
> Tenga en cuenta que `const` significa que la referencia está protegida contra la reasignación. Sin embargo, el valor no es _immutable_ y puede cambiar, especialmente si es una construcción compleja como un objeto.
## Tipos de datos
@ -120,52 +123,52 @@ Hay varios tipos de operadores que se pueden utilizar al realizar funciones arit
| `-` | **Resta**: Calcula la diferencia de dos números | `1 - 2 //la respuesta esperada es -1` |
| `*` | **Multiplicación**: Calcula el producto de dos números | `1 * 2 //la respuesta esperada es 2` |
| `/` | **División**: Calcula el cociente de dos números | `1 / 2 //la respuesta esperada es 0.5` |
| `%` | **Resto**: Calcula el resto a partir de la división de dos números | `1 % 2 //la respuesta esperada es 1` |
| `%` | **Restante**: Calcula el resto a partir de la división de dos números | `1 % 2 //la respuesta esperada es 1` |
✅ ¡Pruébalo! Pruebe una operación aritmética en la consola de su navegador. ¿Te sorprenden los resultados?
### Cadenas
### String
Las cadenas son conjuntos de caracteres que residen entre comillas simples o dobles.
Las cadenas (Strings) son conjuntos de caracteres que residen entre comillas simples o dobles.
- `'Esto es una cadena'`
- `"Esto también es una cadena"`
- `let myString = 'Este es un valor de cadena almacenado en una variable';`
- `'Esto es un String'`
- `"Esto también es un String"`
- `let myString = 'Este es un valor del String almacenado en una variable';`
Recuerde utilizar comillas al escribir una cadena, de lo contrario JavaScript asumirá que es un nombre de variable.
Recuerde utilizar comillas al escribir un String, de lo contrario JavaScript asumirá que es un nombre de variable.
### Formateo de cadenas
### Formateo de Strings
Las cadenas son textuales y requerirán formato de vez en cuando.
Los Strings son textuales y requerirán formato de vez en cuando.
Para **concatenar** dos o más cadenas, o unirlas, use el operador `+`.
Para **concatenar** dos o más Strings, o unirlas, use el operador `+`.
```javascript
let myString1 = "Hello";
let myString2 = "World";
let myString1 = "Hola";
let myString2 = "Mundo";
myString1 + myString2 + "!"; //HelloWorld!
myString1 + " " + myString2 + "!"; //Hello World!
myString1 + ", " + myString2 + "!"; //Hello, World!
myString1 + myString2 + "!"; //¡Hola, mundo!
myString1 + " " + myString2 + "!"; //¡Hola, mundo!
myString1 + ", " + myString2 + "!"; //¡Hola, mundo!
```
✅ ¿Por qué `1 + 1 = 2` en JavaScript, pero `'1' + '1' = 11?` Piense en ello. ¿Qué pasa con `'1' + 1`?
** Los literales de plantilla ** son otra forma de formatear cadenas, excepto que en lugar de comillas, se usa la comilla invertida. Todo lo que no sea texto sin formato debe colocarse dentro de los marcadores de posición `${ }`. Esto incluye cualquier variable que pueda ser cadenas.
**Los literales de plantilla** son otra forma de formatear Strings, excepto que en lugar de comillas, se usa la comilla invertida. Todo lo que no sea texto sin formato debe colocarse dentro de los marcadores de posición `${ }`. Esto incluye cualquier variable que pueda ser Strings.
```javascript
let myString1 = "Hello";
let myString2 = "World";
let myString1 = "Hola";
let myString2 = "Mundo";
`${myString1} ${myString2}!` //Hello World!
`${myString1}, ${myString2}!` //Hello, World!
`${myString1} ${myString2}!` //¡Hola, mundo!
`${myString1}, ${myString2}!` //¡Hola, mundo!
```
Puede lograr sus objetivos de formato con cualquier método, pero los literales de plantilla respetarán los espacios y saltos de línea.
✅ ¿Cuándo usaría una plantilla literal frente a una cadena simple?
✅ ¿Cuándo usaría una plantilla literal frente a un String simple?
### Booleanos
@ -174,11 +177,11 @@ Los booleanos pueden tener solo dos valores: `true` o `false`. Los valores boole
- `let myTrueBool = true`
- `let myFalseBool = false`
✅ Una variable se puede considerar 'verdadera' si se evalúa como un valor booleano 'verdadero'. Curiosamente, en JavaScript, [todos los valores son verdaderos a menos que se definan como falsos](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).
✅ Una variable se puede considerar 'verdadera' si se evalúa como un valor booleano 'verdadero'. Curiosamente, en JavaScript, [todos los valores son verdaderos a menos que se definan como falsos](https://developer.mozilla.org/docs/Glossary/Truthy).
🚀 Desafío: JavaScript es conocido por sus sorprendentes formas de manejar tipos de datos en ocasiones. Investiga un poco sobre estos "errores". Por ejemplo: ¡la sensibilidad a mayúsculas y minúsculas puede morder! Pruebe esto en su consola: `let age = 1; let Age = 2; age == Age` (resuelve `false` - ¿por qué?). ¿Qué otras trampas puedes encontrar?
## [Post-lecture prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/8)
## [Post-lectura prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/8)
## Revisión y autoestudio

@ -1,6 +1,6 @@
# Dasar-dasar JavaScript: Tipe Data
![Dasar-dasar JavaScript - Tipe data](../images/webdev101-js-datatypes.png)
![Dasar-dasar JavaScript - Tipe data](/sketchnotes/webdev101-js-datatypes.png)
> Catatan sketsa oleh [Tomomi Imura](https://twitter.com/girlie_mac)
@ -178,7 +178,7 @@ Boolean hanya dapat berupa dua nilai: `true` atau `false`. Boolean dapat membant
- `let myTrueBool = true`
- `let myFalseBool = false`
✅ Variabel dapat dianggap 'benar (truthy)' jika dievaluasi ke boolean `true`. Menariknya, di JavaScript, [semua nilai adalah benar (truthy) kecuali jika didefinisikan sebagai salah](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).
✅ Variabel dapat dianggap 'benar (truthy)' jika dievaluasi ke boolean `true`. Menariknya, di JavaScript, [semua nilai adalah benar (truthy) kecuali jika didefinisikan sebagai salah](https://developer.mozilla.org/docs/Glossary/Truthy).
---

@ -1,6 +1,6 @@
# Nozioni di base su JavaScript: tipi di dato
![Nozioni di base su JavaScript: tipi di dati](../images/webdev101-js-datatypes.png)
![Nozioni di base su JavaScript: tipi di dati](/sketchnotes/webdev101-js-datatypes.png)
> Sketchnote di [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz pre-lezione
@ -175,7 +175,7 @@ I booleani possono avere solo due valori: vero (`true`) o falso (`false`). I bo
- `let myTrueBool = true`
- `let myFalseBool = false`
✅ Una variabile può essere considerata "veritiera" se restituisce un valore booleano `true`. È interessante notare che in JavaScript [tutti i valori sono veritieri a meno che non siano definiti falsi](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).
✅ Una variabile può essere considerata "veritiera" se restituisce un valore booleano `true`. È interessante notare che in JavaScript [tutti i valori sono veritieri a meno che non siano definiti falsi](https://developer.mozilla.org/docs/Glossary/Truthy).
---

@ -1,6 +1,6 @@
# JavaScript の基本: データ型
![JavaScript Basics - Data types](../images/webdev101-js-datatypes.png)
![JavaScript Basics - Data types](/sketchnotes/webdev101-js-datatypes.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## レッスン前の小テスト

@ -1,6 +1,6 @@
# JavaScript 기초: 데이터 타입
![JavaScript Basics - Data types](../images/webdev101-js-datatypes.png)
![JavaScript Basics - Data types](/sketchnotes/webdev101-js-datatypes.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## 강의 전 퀴즈
@ -176,7 +176,7 @@ let myString2 = "World";
- `let myTrueBool = true`
- `let myFalseBool = false`
✅ 변수가 논리 자료형이 `true`로 설정되면 '참'으로 간주될 수 있습니다. 흥미롭게도, JavaScript에서는 [거짓으로 정의되지 않는다면 모든 값은 참입니다](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).
✅ 변수가 논리 자료형이 `true`로 설정되면 '참'으로 간주될 수 있습니다. 흥미롭게도, JavaScript에서는 [거짓으로 정의되지 않는다면 모든 값은 참입니다](https://developer.mozilla.org/docs/Glossary/Truthy).
---

@ -1,6 +1,6 @@
# Asas JavaScript: Jenis Data
![Asas JavaScript: Jenis Data](../images/webdev101-js-datatypes.png)
![Asas JavaScript: Jenis Data](/sketchnotes/webdev101-js-datatypes.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuiz Pra Kuliah
@ -176,7 +176,7 @@ Booleans boleh hanya dua nilai: `benar` atau `salah`. Booleans dapat membantu me
- `let myTrueBool = betul`
- `let myFalseBool = salah`
✅ Pemboleh ubah boleh dianggap 'benar' jika dinilai menjadi `benar` boolean. Menariknya, dalam JavaScript, [semua nilai adalah benar kecuali ditakrifkan sebagai palsu](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).
✅ Pemboleh ubah boleh dianggap 'benar' jika dinilai menjadi `benar` boolean. Menariknya, dalam JavaScript, [semua nilai adalah benar kecuali ditakrifkan sebagai palsu](https://developer.mozilla.org/docs/Glossary/Truthy).
---

@ -0,0 +1,196 @@
# JavaScript Basics: Gegevenstypen
![JavaScript Basics - Data types](/sketchnotes/webdev101-js-datatypes.png)
> Sketchnote door [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz voorafgaand aan de lezing
[Quiz voorafgaand aan de lezing](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/7)
Deze les behandelt de basisprincipes van JavaScript, de taal die voor interactiviteit op internet zorgt.
[![Gegevenstypen in JavaScript](https://img.youtube.com/vi/JNIXfGiDWM8/0.jpg)](https://youtube.com/watch?v=JNIXfGiDWM8 "Gegevenstypen in JavaScript")
Laten we beginnen met variabelen en de gegevenstypen waarmee ze worden gevuld!
## Variabelen
Variabelen slaan waarden op die in uw code kunnen worden gebruikt en gewijzigd.
Het creëren en **declareren** van een variabele heeft de volgende syntaxis **[sleutelwoord] [naam]**. Het bestaat uit twee delen:
- **Sleutelwoord**. Sleutelwoorden kunnen `let` of `var` zijn.
> Let op, het sleutelwoord `let` is geïntroduceerd in ES6 en geeft uw variabele een zogenaamde _block scope_. Het wordt aanbevolen om `let` over `var` te gebruiken. In toekomstige delen gaan we dieper in op block scopes.
- **De variabelenaam**, dit is een naam die u zelf kiest.
### Taak - werken met variabelen
1. **Declareer een variabele**. Laten we een variabele declareren met het sleutelwoord `let`:
```javascript
let myVariable;
```
`myVariable` is nu gedeclareerd met het `let` sleutelwoord. Het heeft momenteel geen waarde.
1. **Wijs een waarde toe**. Sla een waarde op in een variabele met de operator `=`, gevolgd door de verwachte waarde.
```javascript
myVariable = 123;
```
> Let op: het gebruik van `=` in deze les betekent dat we gebruik maken van een "toewijzingsoperator", die wordt gebruikt om een waarde aan een variabele te geven. Het duidt niet op gelijkheid.
`myVariable` is nu *geïnitialiseerd* met de waarde 123.
1. **Refactor**. Vervang uw code door de volgende verklaring.
```javascript
let myVariable = 123;
```
Het bovenstaande wordt een _expliciete initialisatie_ genoemd wanneer een variabele wordt gedeclareerd en tegelijkertijd een waarde krijgt toegewezen.
1. **Wijzig de variabele waarde**. Wijzig de waarde van de variabele op de volgende manier:
```javascript
myVariable = 321;
```
Zodra een variabele is gedeclareerd, kunt u de waarde ervan op elk moment in uw code wijzigen met de operator `=` en de nieuwe waarde.
✅ Probeer het! U kunt JavaScript rechtstreeks in uw browser schrijven. Open een browservenster en ga naar Developer Tools. In de console vind u een prompt; typ `let myVariable = 123`, druk op Return en typ vervolgens `myVariable`. Wat gebeurt er? Let op, in de volgende lessen leert u meer over deze concepten.
## Constanten
Declaratie en initialisatie van een constante volgt dezelfde concepten als een variabele, met uitzondering van het sleutelwoord `const`. Constanten worden doorgaans gedeclareerd met alleen hoofdletters.
```javascript
const MY_VARIABLE = 123;
```
Constanten zijn vergelijkbaar met variabelen, met twee uitzonderingen:
- **Moet waarde hebben**. Constanten moeten worden geïnitialiseerd, anders treedt er een fout op bij het uitvoeren van code.
- **Referentie kan niet worden gewijzigd**. De referentie van een constante kan niet worden gewijzigd nadat deze is geïnitialiseerd, anders treedt er een fout op bij het uitvoeren van code. Laten we naar twee voorbeelden kijken:
- **Eenvoudige waarde**. Het volgende is NIET toegestaan:
```javascript
const PI = 3;
PI = 4; // niet toegestaan
```
- **Objectreferentie is beveiligd**. Het volgende is NIET toegestaan.
```javascript
const obj = { a: 3 };
obj = { b: 5 } // niet toegestaan
```
- **Objectwaarde is niet beschermd**. Het volgende is toegestaan:
```javascript
const obj = { a: 3 };
obj.a = 5; // toegestaan
```
Hierboven verandert u de waarde van het object maar niet de referentie zelf, waardoor het toegestaan is.
> Let op: een 'const' betekent dat de referentie is beschermd tegen opnieuw toewijzen. De waarde is echter niet _onveranderlijk_ en kan veranderen, vooral als het een complexe constructie is, zoals een object.
## Gegevenstypen
Variabelen kunnen veel verschillende soorten waarden opslaan, zoals getallen en tekst. Deze verschillende soorten waarden staan bekend als het **gegevenstype**. Gegevenstypen zijn een belangrijk onderdeel van softwareontwikkeling omdat het ontwikkelaars helpt beslissingen te nemen over hoe de code moet worden geschreven en hoe de software moet worden uitgevoerd. Bovendien hebben sommige gegevenstypen unieke kenmerken die helpen bij het transformeren of extraheren van aanvullende informatie in een waarde.
✅ Gegevenstypen worden ook wel JavaScript-gegevensprimitieven genoemd, omdat dit de gegevenstypen op het laagste niveau zijn die door de taal worden geleverd. Er zijn 6 primitieve gegevenstypen: string, number, bigint, boolean, undefined, en symbol. Neem even de tijd om te visualiseren wat elk van deze primitieven zou kunnen vertegenwoordigen. Wat is een `zebra`? Hoe zit het met `0`? `true`?
### Getallen
In de vorige sectie was de waarde van `myVariable` een gegevenstype met een getal.
`let myVariable = 123;`
Variabelen kunnen alle soorten getallen opslaan, inclusief decimalen of negatieve getallen. Getallen kunnen ook worden gebruikt met rekenkundige operatoren, behandeld in de [volgende sectie](#operators).
### Rekenkundige operatoren
Er zijn verschillende soorten operatoren die kunnen worden gebruikt bij het uitvoeren van rekenkundige functies, en sommige worden hier vermeld:
| Symbool | beschrijving | Voorbeeld |
| ------- | ------------------------------------------------------------- | ---------------------------------- |
| `+` | **Toevoeging**: Berekent de som van twee getallen | `1 + 2 //verwacht antwoord is 3` |
| `-` | **Aftrekken**: Berekent het verschil tussen twee getallen | `1 - 2 //verwacht antwoord is -1` |
| `*` | **Vermenigvuldiging**: Berekent het product van twee getallen | `1 * 2 //verwacht antwoord is 2` |
| `/` | **Divisie**: Berekent het quotiënt van twee getallen | `1 / 2 //verwacht antwoord is 0.5` |
| `%` | **Rest**: Berekent de rest uit de deling van twee getallen | `1 % 2 //verwacht antwoord is 1` |
✅ Probeer het! Probeer een rekenkundige bewerking in de console van uw browser. Verrassen de resultaten u?
### Strings
Strings zijn sets van tekens die tussen enkele of dubbele aanhalingstekens staan.
- `'Dit is een string'`
- `"Dit is ook een string"`
- `let myString = 'Dit is een tekenreekswaarde die is opgeslagen in een variabele';`
Denk eraan om aanhalingstekens te gebruiken bij het schrijven van een string, anders neemt JavaScript aan dat het een variabelenaam is.
### Strings formatteren
Strings zijn tekstueel en moeten van tijd tot tijd worden opgemaakt.
Gebruik de operator `+` om twee of meer strings **samen te voegen**.
```javascript
let myString1 = "Hello";
let myString2 = "World";
myString1 + myString2 + "!"; //HelloWorld!
myString1 + " " + myString2 + "!"; //Hello World!
myString1 + ", " + myString2 + "!"; //Hello, World!
```
✅ Waarom is `1 + 1 = 2` in JavaScript, maar `'1' + '1' = 11?` Denk er eens over na. Hoe zit het met `'1' + 1`?
**Template literals** zijn een andere manier om strings op te maken, behalve dat in plaats van aanhalingstekens de backtick wordt gebruikt. Alles wat geen platte tekst is, moet tussen tijdelijke aanduidingen `${}` worden geplaatst. Dit omvat alle variabelen die strings kunnen zijn.
```javascript
let myString1 = "Hello";
let myString2 = "World";
`${myString1} ${myString2}!` //Hello World!
`${myString1}, ${myString2}!` //Hello, World!
```
U kunt uw opmaakdoelen met beide methoden bereiken, maar template literals respecteren alle spaties en regeleinden.
✅ Wanneer zou u een template literal versus een gewone string gebruiken?
### Booleans
Booleans kunnen slechts twee waarden zijn: `true` of `false`. Booleans kunnen helpen bij het nemen van beslissingen over welke regels code moeten worden uitgevoerd wanneer aan bepaalde voorwaarden is voldaan. In veel gevallen helpen [operatoren](# operators) bij het instellen van de waarde van een Boolean waarde en u zult vaak merken en variabelen schrijven die geïnitialiseerd worden of dat hun waarden worden bijgewerkt met een operator.
- `let myTrueBool = true`
- `let myFalseBool = false`
✅ Een variabele kan als 'waar' worden beschouwd als deze resulteert in een boolean waarde `true`. Interessant is dat in JavaScript [alle waarden waarheidsgetrouw zijn, tenzij ze als onjuist zijn gedefinieerd](https://developer.mozilla.org/nl/docs/Glossary/Truthy).
---
## 🚀 Uitdaging
JavaScript is berucht om zijn verrassende manieren om af en toe met gegevenstypen om te gaan. Doe een beetje onderzoek naar deze 'valstrikken'. Bijvoorbeeld: hoofdlettergevoeligheid kan bijten! Probeer dit in uw console: `let age = 1; let Age = 2; age == Age` (lost `false` op - waarom?). Welke andere valstrikken kunt u vinden?
## Quiz na de lezing
[Quiz na de lezing](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/8)
## Beoordeling en zelfstudie
Bekijk [deze lijst met JavaScript-oefeningen](https://css-tricks.com/snippets/javascript/) en probeer er een. Wat heeft u geleerd?
## Toewijzing
[Gegevenstypen Oefening](assignment.nl.md)

@ -0,0 +1,197 @@
# JavaScript 入門 - 資料型態
![JavaScript 入門 - 資料型態](/sketchnotes/webdev101-js-datatypes.png)
> 由 [Tomomi Imura](https://twitter.com/girlie_mac) 繪製
## 課前測驗
[課前測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/7?loc=zh_tw)
這堂課會講述 Javascript 的基礎 ── 一款建立互動性網頁的程式語言。
[![JavaScript 的資料型態](https://img.youtube.com/vi/JNIXfGiDWM8/0.jpg)](https://youtube.com/watch?v=JNIXfGiDWM8 "JavaScript 的資料型態")
讓我們從程式語言的基礎 ── 「變數」與「資料型態」開始吧!
## 變數 (Variable)
變數會依照程式碼調整並儲存數值。
建立並**宣告**變數的語法有一定的格式: **[關鍵字(keyword)] [變數名稱(name)]**。下列開始分別敘述:
- **關鍵字 (Keyword)** 關鍵字可以是 `let` 或者是 `var`
> 注意,關鍵字 `let` 在 ES6 被導入進去,為變數限制 _區塊範疇(block scope)_。 建議上使用 `let` 勝過於 `var`。我們在往後的章節會講述什麼是區塊範疇。
- **變數名稱 (Variable Name)** 你可以自己定義變數名稱。
### 課題:變數的操作
1. **宣告變數** 利用關鍵字 `let` 來宣告新的變數:
```javascript
let myVariable;
```
`myVariable` 已經被關鍵字 `let` 宣告出來了。它現在並沒有被賦予數值。
1. **賦予數值** 以運算子 `=` 來為變數新增數值,後面加上預期的數字。
```javascript
myVariable = 123;
```
> 注意:本堂課程中的運算子 `=` 只作為「指派運算子」,處理賦予數值的功用。它與「等於」並沒有關係。
變數 `myVariable` 現在已經被*初始化*為數值 123。
1. **代碼重構 (Refactor)** 改寫你的程式碼為:
```javascript
let myVariable = 123;
```
合併「宣告變數」與「賦予數值」為一條程式碼的步驟稱為 _顯式初始化 (explicit initialization)_
1. **更改變數數值** 透過下列的方式更改參數數值:
```javascript
myVariable = 321;
```
一旦變數被宣告後,你在任何往後的程式碼利用運算子 `=` 賦予新的數值。
✅ 動手試試看! 在瀏覽器中撰寫 JavaScript開啟瀏覽器並前往開發者工具你會在 Console 頁面找到命令提示字元。輸入 `let myVariable = 123` 並按下 Enter。輸入 `myVariable`。它出現了什麼? 往後,你會學到更多這些觀念的課程。
## 常數 (Constants)
宣告與初始化常數的行為與變數相似,只差在關鍵字 `const`。通常常數會以全大寫的方式命名。
```javascript
const MY_VARIABLE = 123;
```
常數與變數非常類似,主要的兩大差別為:
- **一定要附帶數值** 常數一定要被初始化過,否則在執行程式時會產生錯誤。
- **參考(Reference)不能被改變** 變數與常數都能根據其他變數或常數作為定義,但是常數的參考在初始化後,就不能再被更改,否則在執行程式時會產生錯誤。我們來看下列兩種例子:
- **簡單數值** 下列程式碼是不被允許的:
```javascript
const PI = 3;
PI = 4; // 錯誤
```
- **有限存取的參考物件** 下列程式碼是不被允許的:
```javascript
const obj = { a: 3 };
obj = { b: 5 } // 錯誤
```
- **參考物件** 下列程式碼是「允許」的:
```javascript
const obj = { a: 3 };
obj.a = 5; // OK
```
上述只改變物件的數值而非物件本身,這是可以被允許的。
> 注意,`const` 代表參考物件在重新賦值上有存取的限制。數值並不是永遠 _不可變的_,如果數值是規劃在其他物件上的話。
## 資料型態 (Data types)
變數可以儲存不一樣的數值型態,好比是數字或是文字。這些多樣的數值型態被稱為**資料型態**。資料型態是軟體開發上重要的環節,它能幫助開發者釐清程式該如何被填寫以及運作。除此之外,有些獨特的資料型態能改變或賦加而外的數值資訊。
✅ 資料型態也存在於 JavaScript 的原始結構中它們是程式語言中最低階的描述方式。六種資料型態string、number、bigint、boolean、undefined 和 symbol。 花點時間了解它們的含義。資料 `zebra` 屬於哪一類? 那 `0` 呢? `true` 呢?
### 數字 (Numbers)
在前一個段落中,`myVariable`的數值屬於數字型。
`let myVariable = 123;`
變數能儲存所有類型的數字,包含小數點與負數。數字也可以被套用在四則運算上,這被放在[下一個段落](#operators)中。
### 算術運算子 (Arithmetic Operators)
這些是做四則運算時會使用到的算術運算子,下列舉出了幾項例子:
| 符號 | 描述 | 舉例 |
| ------ | ------------------------------| --------------------- |
| `+` | **加法** 對兩數做相加 | `1 + 2 // 答案為 3` |
| `-` | **減法** 對兩數做相減 | `1 - 2 // 答案為 -1` |
| `*` | **乘法** 對兩數做相乘 | `1 * 2 // 答案為 2` |
| `/` | **除法** 對兩數做相除 | `1 / 2 // 答案為 0.5` |
| `%` | **餘數** 取得兩數相除的餘數 | `1 % 2 // 答案為 1` |
✅ 試試看!在瀏覽器命令欄中使用算數運算子。你得到了什麼結果?
### 字串 (Strings)
字串由多組字元組成,會以單引號或雙引號匡列起來。
- `'這是一組字串'`
- `"這也是一組字串"`
- `let myString = '這是被存在變數中的字串';`
記得使用引號來編寫字串,否則 JavaScript 會把字串內容當作是變數名稱。
### 字串格式化
字串由文字組成,自然需要隨時間而做修正。
要**串接**兩個以上的字串,可以使用運算子 `+`
```javascript
let myString1 = "Hello";
let myString2 = "World";
myString1 + myString2 + "!"; //HelloWorld!
myString1 + " " + myString2 + "!"; //Hello World!
myString1 + ", " + myString2 + "!"; //Hello, World!
```
✅ 在 JavaScript 中,為什麼 `1 + 1 = 2`,但是 `'1' + '1' = 11` 呢? 想想看。那 `'1' + 1` 呢?
**樣板字面值(Template literals)**是另一種格式化字串的方式,它不使用引號,而是使用反引號。任何非純文字字串必須放在 `${ }` 中。這會包入字串型態的任何變數。
```javascript
let myString1 = "Hello";
let myString2 = "World";
`${myString1} ${myString2}!` //Hello World!
`${myString1}, ${myString2}!` //Hello, World!
```
這樣就可以達到字串格式化的目的,但要注意樣板字面會遵守變數中的空格與分行符號。
✅ 什麼情況下該使用樣板字面,或者是純文字字串呢?
### 布林 (Booleans)
布林有兩種數值:`true` 或 `false`,使用在程式碼做條件決定的時候。在多數情況下,[運算子](#operators)可以套用在布林上,你會在初始化或更新數值時使用。
- `let myTrueBool = true`
- `let myFalseBool = false`
✅ 布林值 `true` 亦有廣義的 'truthy' 數值。有趣的是,在 JavaScript 中,[除非被定義為 falsy其餘的數值都會被當作是 truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy)。
---
## 🚀 挑戰
JavaScript 在處理資料結構時有許多種方法,有些場合為人詬病。在這方面做一些調查,例如:大小寫敏感性的問題!在命令欄中輸入看看: `let age = 1; let Age = 2; age == Age`,輸出結果是 `false`,為什麼? 你能找到其他問題嗎?
## 課後測驗
[課後測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/8?loc=zh_tw)
## 複習與自學
試試看[這些 JavaScript 練習題](https://css-tricks.com/snippets/javascript/)。 你學到了什麼?
## 作業
[練習資料型態](assignment.zh-tw.md)

@ -0,0 +1,11 @@
# Gegevenstypen Oefening
## Instructies
Stelt u voor dat u een winkelwagentje aan het bouwen bent. Schrijf wat documentatie over de gegevenstypen die u nodig zou hebben om uw winkelervaring te voltooien. Hoe bent u tot uw keuzes gekomen?
## Rubriek
Criteria | Voorbeeldig | Voldoende | Moet worden verbeterd
--- | --- | --- | -- |
||De zes gegevenstypen worden opgesomd en in detail onderzocht, waarbij het gebruik ervan wordt gedocumenteerd|Vier gegevenstypen worden onderzocht|Twee gegevenstypen worden onderzocht|

@ -0,0 +1,11 @@
# 練習資料型態
## 簡介
想像你要建立一條購物清單,寫下你需要使用的資料型態。你是怎麼做出這些選擇的?
## 學習評量
| 作業內容 | 優良 | 普通 | 待改進 |
| -------- | ---------------------------------- | ---------------------------------- | ---------------------------------- |
| | 使用六種資料型態並解釋用途以及用法 | 使用四種資料型態並解釋用途以及用法 | 使用兩種資料型態並解釋用途以及用法 |

@ -1,6 +1,6 @@
# JavaScript Basics: Methods and Functions
![JavaScript Basics - Functions](images/webdev101-js-functions.png)
![JavaScript Basics - Functions](/sketchnotes/webdev101-js-functions.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz
@ -104,7 +104,7 @@ displayGreeting('Christopher', 'Hi');
## Return values
Up until now the function we built will always output to the [console](https://developer.mozilla.org/en-US/docs/Web/API/console). Sometimes this can be exactly what we're looking for, especially when we create functions which will be calling other services. But what if I want to create a helper function to perform a calculation and provide the value back so I can use it elsewhere?
Up until now the function we built will always output to the [console](https://developer.mozilla.org/docs/Web/API/console). Sometimes this can be exactly what we're looking for, especially when we create functions which will be calling other services. But what if I want to create a helper function to perform a calculation and provide the value back so I can use it elsewhere?
We can do this by using a **return value**. A return value is returned by the function, and can be stored in a variable just the same as we could store a literal value such as a string or number.
@ -133,7 +133,7 @@ const greetingMessage = createGreetingMessage('Christopher');
As you progress in your programming career, you will come across functions which accept functions as parameters. This neat trick is commonly used when we don't know when something is going to occur or complete, but we know we need to perform an operation in response.
As an example, consider [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), which begins a timer and will execute code when it completes. We need to tell it what code we want to execute. Sounds like a perfect job for a function!
As an example, consider [setTimeout](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), which begins a timer and will execute code when it completes. We need to tell it what code we want to execute. Sounds like a perfect job for a function!
If you run the code below, after 3 seconds you'll see the message **3 seconds has elapsed**.
@ -188,7 +188,7 @@ Can you articulate in one sentence the difference between functions and methods?
## Review & Self Study
It's worth [reading up a little more on arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions), as they are increasingly used in code bases. Practice writing a function, and then rewriting it with this syntax.
It's worth [reading up a little more on arrow functions](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/Arrow_functions), as they are increasingly used in code bases. Practice writing a function, and then rewriting it with this syntax.
## Assignment

@ -101,7 +101,7 @@ displayGreeting('Christopher', 'Hi');
## Rückgabewerte
Bisher wurde die von uns erstellte Funktion immer an die [Konsole](https://developer.mozilla.org/en-US/docs/Web/API/console) ausgegeben. Manchmal kann dies genau das sein, wonach wir suchen, insbesondere wenn wir Funktionen erstellen, die andere Dienste aufrufen. Was aber, wenn ich eine Hilfsfunktion erstellen möchte, um eine Berechnung durchzuführen und den Wert zurückzugeben, damit ich ihn an anderer Stelle verwenden kann?
Bisher wurde die von uns erstellte Funktion immer an die [Konsole](https://developer.mozilla.org/docs/Web/API/console) ausgegeben. Manchmal kann dies genau das sein, wonach wir suchen, insbesondere wenn wir Funktionen erstellen, die andere Dienste aufrufen. Was aber, wenn ich eine Hilfsfunktion erstellen möchte, um eine Berechnung durchzuführen und den Wert zurückzugeben, damit ich ihn an anderer Stelle verwenden kann?
Wir können dies tun, indem wir einen **Rückgabewert** verwenden. Ein Rückgabewert wird von der Funktion zurückgegeben und kann in einer Variablen genauso gespeichert werden, wie wir einen Literalwert wie eine Zeichenfolge oder eine Zahl speichern könnten.
@ -131,7 +131,7 @@ const greetingMessage = createGreetingMessage('Christopher');
Im Laufe Ihrer Programmierkarriere werden Sie auf Funktionen stoßen, die Funktionen als Parameter akzeptieren. Dieser nette Trick wird häufig verwendet, wenn wir nicht wissen, wann etwas eintreten oder abgeschlossen sein wird, aber wir wissen, dass wir als Reaktion darauf eine Operation ausführen müssen.
Betrachten Sie als Beispiel [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), das einen Timer startet und nach dessen Ausführung Code ausführt. Wir müssen ihm sagen, welchen Code wir ausführen wollen. Klingt nach einem perfekten Job für eine Veranstaltung!
Betrachten Sie als Beispiel [setTimeout](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), das einen Timer startet und nach dessen Ausführung Code ausführt. Wir müssen ihm sagen, welchen Code wir ausführen wollen. Klingt nach einem perfekten Job für eine Veranstaltung!
Wenn Sie den folgenden Code ausführen, wird nach 3 Sekunden die Meldung **3 Sekunden sind verstrichen** angezeigt.
@ -188,7 +188,7 @@ Können Sie den Unterschied zwischen Funktionen und Methoden in einem Satz artik
## Review & Selbststudium
Es lohnt sich, [etwas mehr über Pfeilfunktionen zu lesen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions), da diese zunehmend in Codebasen verwendet werden. Üben Sie, eine Funktion zu schreiben und sie dann mit dieser Syntax neu zu schreiben.
Es lohnt sich, [etwas mehr über Pfeilfunktionen zu lesen](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/Arrow_functions), da diese zunehmend in Codebasen verwendet werden. Üben Sie, eine Funktion zu schreiben und sie dann mit dieser Syntax neu zu schreiben.
## Zuordnung

@ -1,10 +1,14 @@
# Conceptos básicos de JavaScript: métodos y funciones
[![Métodos y funciones](https://img.youtube.com/vi/XgKsD6Zwvlc/0.jpg)](https://youtube.com/watch?v=XgKsD6Zwvlc "Métodos y funciones")
![JavaScript Basics - Functions](/sketchnotes/webdev101-js-functions.png)
> Sketchnote por [Tomomi Imura](https://twitter.com/girlie_mac)
## [Pre-lecture prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/9)
# Conceptos básicos de JavaScript: funcións y funciones
Cuando necesite su código para realizar una tarea, utilizará un método o una función. Analicemos las diferencias.
[![funcións y funciones](https://img.youtube.com/vi/XgKsD6Zwvlc/0.jpg)](https://youtube.com/watch?v=XgKsD6Zwvlc "funcións y funciones")
## [Pre-lectura prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/9)
Cuando necesite su código para realizar una tarea, utilizará un función o una función. Analicemos las diferencias.
## Funciones
@ -16,10 +20,94 @@ function name(param, param2, param3) { // definición de función
}
```
## Métodos
## Funciónes (Functions)
En esencia, una función es un bloque de código que podemos ejecutar bajo demanda. Esto es perfecto para escenarios en los que necesitamos realizar la misma tarea varias veces; en lugar de duplicar la lógica en varias ubicaciones (lo que dificultaría la actualización cuando llegue el momento), podemos centralizarla en una ubicación y llamarla cuando necesitemos que se realice la operación; ¡incluso puede llamar a funciones desde otras funciones!
Igual de importante es la capacidad de nombrar una función. Si bien esto puede parecer trivial, el nombre proporciona una forma rápida de documentar una sección de código. Podría pensar en esto como una etiqueta en un botón. Si hago clic en un botón que dice "Cancelar temporizador", sé que dejará de correr el reloj.
## Creating and calling a function
La sintaxis de una función se parece a la siguiente:
```javascript
function nameOfFunction() { // function definition
// function definition/body
}
```
Si quisiera crear una función para mostrar un saludo, podría verse así:
```javascript
function displayGreeting() {
console.log('¡Hola, mundo!');
}
```
Siempre que queremos llamar (o invocar) nuestra función, usamos el nombre de la función seguido de `()`. Vale la pena señalar el hecho de que nuestra función se puede definir antes o después de que decidamos llamarla; el compilador de JavaScript lo encontrará por usted.
```javascript
// calling our function
displayGreeting();
```
> **NOTA:** Existe un tipo especial de función conocida como **método**, que ya ha estado utilizando. De hecho, vimos esto en nuestra demostración anterior cuando usamos `console.log`. Lo que hace que un método sea diferente de una función es que un método está adjunto a un objeto (`consola` en nuestro ejemplo), mientras que una función es flotante libre. Escuchará que muchos desarrolladores usan estos términos indistintamente.
TODO
### Mejores prácticas de función
Hay algunas prácticas recomendadas que se deben tener en cuenta al crear funciones:
- Como siempre, use nombres descriptivos para que sepa lo que hará la función
- Usa **camelCasing** para combinar palabras
- Mantenga sus funciones enfocadas en una tarea específica
## Pasar información a una función
Para que una función sea más reutilizable, a menudo querrá pasarle información. Si consideramos nuestro ejemplo de `displayGreeting` anterior, solo mostrará **¡Hola, mundo!**. No es la función más útil que uno podría crear. Si queremos hacerlo un poco más flexible, como permitir que alguien especifique el nombre de la persona a saludar, podemos agregar un **parámetro**. Un parámetro (también llamado a veces **argumento**), es información adicional enviada a una función.
Los parámetros se enumeran en la parte de definición entre paréntesis y están separados por comas así:
```javascript
function name(param, param2, param3) {
}
```
Podemos actualizar nuestro `displayGreeting` para aceptar un nombre y mostrarlo.
```javascript
function displayGreeting(name) {
const message = `¡Hola, ${name}!`;
console.log(message);
}
```
Cuando queremos llamar a nuestra función y pasar el parámetro, lo especificamos entre paréntesis.
```javascript
displayGreeting('Paco');
// dice "¡Hola, Paco!" cuando ejecutas el comando
```
## Valores predeterminados
Podemos hacer que nuestra función sea aún más flexible agregando más parámetros. Pero, ¿y si no queremos que se especifiquen todos los valores? Siguiendo con nuestro ejemplo de saludo, podríamos dejar el nombre según sea necesario (necesitamos saber a quién saludamos), pero queremos permitir que el saludo en sí se personalice como desee. Si alguien no quiere personalizarlo, proporcionamos un valor predeterminado en su lugar. Para proporcionar un valor predeterminado a un parámetro, lo configuramos de la misma manera que configuramos un valor para una variable: `parameterName = 'defaultValue'`. Para ver un ejemplo completo:
```javascript
function displayGreeting(name, salutation='Hola') {
console.log(`${salutation}, ${name}`);
}
```
Cuando llamamos a la función, podemos decidir si queremos establecer un valor para el "saludo".
```javascript
displayGreeting('Paco');
// dice "Hola, Paco"
displayGreeting('Paco', 'Hola');
// dice "Hola, Paco"
```
### Parámetro
Los parámetros se enumeran en la parte de definición entre paréntesis y están separados por comas así:
@ -30,7 +118,9 @@ Los parámetros se enumeran en la parte de definición entre paréntesis y está
### Parámetro
Cuerpo de función
Hasta ahora, la función que construimos siempre saldrá a la [consola](https://developer.mozilla.org/en-US/docs/Web/API/console). A veces, esto puede ser exactamente lo que estamos buscando, especialmente cuando creamos funciones que llamarán a otros servicios. Pero, ¿qué pasa si quiero crear una función auxiliar para realizar un cálculo y devolver el valor para poder usarlo en otro lugar?
Podemos hacer esto usando un **valor de retorno**. La función devuelve un valor de retorno y se puede almacenar en una variable de la misma manera que podríamos almacenar un valor literal como una cadena o un número.
Aquí define qué tarea debe realizar la función. Una función puede devolver algo o no. Si una función devuelve algo, entonces se usa la palabra clave `return`. La palabra clave `return` espera un valor o referencia de lo que se devuelve así:
@ -52,7 +142,7 @@ En el código anterior, se devuelve la variable `sum`.
### Invocación
Cuando _invocas_ una función, la llamas con 0...N conjuntos de argumentos. Los valores de los argumentos se vinculan a los parámetros correspondientes a su posición. El método `add()` introducido se puede invocar de la siguiente manera:
Cuando _invocas_ una función, la llamas con 0...N conjuntos de argumentos. Los valores de los argumentos se vinculan a los parámetros correspondientes a su posición. El función `add()` introducido se puede invocar de la siguiente manera:
```javascript
@ -64,7 +154,7 @@ Los argumentos `1` y `3` están vinculados a los parámetros `firstValue` y `sec
JavaScript es bastante flexible cuando se trata de invocaciones. No está obligado a proporcionar argumentos para todos los parámetros, el código se ejecutará de todos modos. Sin embargo, dependiendo de lo que le pase, es posible que el código no se comporte como se esperaba.
> Desafío, intente llamar al método `add()` así `add(1)` y vea qué sucede
> Desafío, intente llamar al función `add()` así `add(1)` y vea qué sucede
### Valores predeterminados
@ -93,7 +183,7 @@ Cualquier parámetro con valores predeterminados debe estar al final de la lista
## Revisión y autoestudio
TODO
Vale la pena [leer un poco más sobre las funciones de flecha](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions), ya que se utilizan cada vez más en bases de código. Practique escribir una función y luego reescribirla con esta sintaxis.
**Tarea**: [Práctica de tipos de datos](assignment.es.md)

@ -1,6 +1,6 @@
# Dasar-dasar JavaScript: Metode dan Fungsi
![Dasar-dasar JavaScript - Fungsi](../images/webdev101-js-functions.png)
![Dasar-dasar JavaScript - Fungsi](/sketchnotes/webdev101-js-functions.png)
> Catatan sketsa oleh [Tomomi Imura](https://twitter.com/girlie_mac)
@ -102,7 +102,7 @@ tampilkanSapaan("Christopher", "Hi");
## Nilai Kembali (Return values)
Hingga saat ini fungsi yang kita buat akan selalu menghasilkan [konsol](https://developer.mozilla.org/en-US/docs/Web/API/console). Terkadang ini persis seperti yang kita cari, terutama saat kita membuat fungsi yang akan memanggil layanan lain. Tetapi bagaimana jika saya ingin membuat fungsi pembantu untuk melakukan kalkulasi dan memberikan nilai kembali sehingga saya dapat menggunakannya di tempat lain?
Hingga saat ini fungsi yang kita buat akan selalu menghasilkan [konsol](https://developer.mozilla.org/docs/Web/API/console). Terkadang ini persis seperti yang kita cari, terutama saat kita membuat fungsi yang akan memanggil layanan lain. Tetapi bagaimana jika saya ingin membuat fungsi pembantu untuk melakukan kalkulasi dan memberikan nilai kembali sehingga saya dapat menggunakannya di tempat lain?
Kita bisa melakukan ini dengan menggunakan **nilai kembali (return value)**. Nilai kembali dikembalikan oleh fungsi, dan dapat disimpan dalam variabel sama seperti kita dapat menyimpan nilai literal seperti string atau angka.
@ -131,7 +131,7 @@ const pesanSapaan = buatPesanSapaan("Christopher");
Saat Anda maju dalam karir pemrograman Anda, Anda akan menemukan fungsi yang menerima fungsi sebagai parameter. Trik rapi ini biasanya digunakan ketika kita tidak tahu kapan sesuatu akan terjadi atau selesai, tetapi kita tahu kita perlu melakukan operasi sebagai tanggapan.
Sebagai contoh, pertimbangkan [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), yang memulai timer dan akan mengeksekusi kode setelah selesai. Kita perlu memberi tahu kode apa yang ingin kita jalankan. Kedengarannya seperti pekerjaan yang sempurna untuk suatu fungsi!
Sebagai contoh, pertimbangkan [setTimeout](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), yang memulai timer dan akan mengeksekusi kode setelah selesai. Kita perlu memberi tahu kode apa yang ingin kita jalankan. Kedengarannya seperti pekerjaan yang sempurna untuk suatu fungsi!
Jika Anda menjalankan kode di bawah ini, setelah 3 detik Anda akan melihat pesan **3 detik telah berlalu**.
@ -187,7 +187,7 @@ Bisakah Anda mengartikulasikan dalam satu kalimat perbedaan antara fungsi dan me
## Review & Belajar Mandiri
Layak [membaca lebih banyak tentang fungsi panah](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions), karena semakin sering digunakan dalam basis kode. Berlatihlah menulis fungsi, lalu menulis ulang dengan sintaks ini.
Layak [membaca lebih banyak tentang fungsi panah](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/Arrow_functions), karena semakin sering digunakan dalam basis kode. Berlatihlah menulis fungsi, lalu menulis ulang dengan sintaks ini.
## Tugas

@ -1,6 +1,6 @@
# Nozioni di base su JavaScript: Metodi e Funzioni
![Nozioni di base su JavaScript - Funzioni](../images/webdev101-js-functions.png)
![Nozioni di base su JavaScript - Funzioni](/sketchnotes/webdev101-js-functions.png)
> Sketchnote di [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz pre-lezione
@ -131,7 +131,7 @@ const greetingMessage = createGreetingMessage('Christopher');
Man mano che si progredisce nella propria carriera di programmatore, ci si imbatterà in funzioni che accettano funzioni come parametri. Questo trucco è comunemente usato quando non si sa quando qualcosa accadrà o sarà completata, ma si sa che si deve eseguire un'operazione in risposta.
Come esempio si consideri [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), che fa partire un timer ed eseguirà del codice il tempo viene esaurito. Occorre dirgli quale codice si vuole eseguire. Sembra un lavoro perfetto per una funzione!
Come esempio si consideri [setTimeout](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), che fa partire un timer ed eseguirà del codice il tempo viene esaurito. Occorre dirgli quale codice si vuole eseguire. Sembra un lavoro perfetto per una funzione!
Se si esegue il codice qui sopra, dopo 3 secondi si vedrà il messaggio **3 seconds has elapsed** (sono trascorsi 3 secondi).
@ -188,7 +188,7 @@ Si riesce ad articolare in una frase la differenza tra funzioni e metodi? Fare u
## Revisione e auto apprendimento
Vale la pena [leggere un poco di più sulle funzioni arrow](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions), poiché sono sempre più utilizzate nelle basi di codice. Esercitarsi a scrivere una funzione, quindi riscriverla con questa sintassi.
Vale la pena [leggere un poco di più sulle funzioni arrow](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/Arrow_functions), poiché sono sempre più utilizzate nelle basi di codice. Esercitarsi a scrivere una funzione, quindi riscriverla con questa sintassi.
## Compito

@ -1,6 +1,6 @@
# JavaScript の基本: メソッドと関数
![JavaScript Basics - Functions](../images/webdev101-js-functions.png)
![JavaScript Basics - Functions](/sketchnotes/webdev101-js-functions.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## レッスン前の小テスト

@ -1,6 +1,6 @@
# JavaScript 기초: 메소드와 함수
![JavaScript Basics - Functions](../images/webdev101-js-functions.png)
![JavaScript Basics - Functions](/sketchnotes/webdev101-js-functions.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## 강의 전 퀴즈
@ -101,7 +101,7 @@ displayGreeting('Christopher', 'Hi');
## 반환 값
지금까지 만든 함수는 항상 [console](https://developer.mozilla.org/en-US/docs/Web/API/console)에 출력됩니다. 특히 다른 서비스를 호출할 함수를 만들 때도 이것이 찾고 있을 수 있습니다. 하지만 계산을 하고 값을 다른 곳에 다시 제공하고자 헬퍼 함수를 만들고 싶으면 어떻게 해야합니까?
지금까지 만든 함수는 항상 [console](https://developer.mozilla.org/docs/Web/API/console)에 출력됩니다. 특히 다른 서비스를 호출할 함수를 만들 때도 이것이 찾고 있을 수 있습니다. 하지만 계산을 하고 값을 다른 곳에 다시 제공하고자 헬퍼 함수를 만들고 싶으면 어떻게 해야합니까?
**반환 값**을 사용하면 할 수 있습니다. 반환 값은 함수에 의해 반환되며, 문자열이나 숫자와 같은 리터럴 값을 저장할 수 있고 똑같은 변수에 저장할 수 있습니다.
@ -130,7 +130,7 @@ const greetingMessage = createGreetingMessage('Christopher');
프로그래밍 경력을 쌓으면서, 함수를 매개 변수로 받는 함수를 보게 될 것 입니다. 이 깔끔한 트릭은 일반적으로 어떤 일이 발생되거나 완료되는 때를 알지 못하지만, 이에 반응하여 작업해야 한다는 것을 알고있을 때 사용됩니다.
예시로, 타이머를 시작하고 완료되면 코드를 실행하는 [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout)을 고려해보세요. 실행하려는 코드를 먼저 알려줘야 합니다. 함수에 대한 완벽한 직업인 것 같습니다!
예시로, 타이머를 시작하고 완료되면 코드를 실행하는 [setTimeout](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout)을 고려해보세요. 실행하려는 코드를 먼저 알려줘야 합니다. 함수에 대한 완벽한 직업인 것 같습니다!
아래 코드를 실행하면, 3초 후에 **3 seconds has elapsed**는 메시지가 표시됩니다.
@ -185,7 +185,7 @@ setTimeout(3000, () => {
## 리뷰 & 자기주도 학습
화살표 함수는 코드 베이스에서 점점 많이 사용되고 있으므로, [읽어 볼 가치](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)가 있습니다. 함수 작성을 연습한 다음에 syntax로 다시 작성하십시오.
화살표 함수는 코드 베이스에서 점점 많이 사용되고 있으므로, [읽어 볼 가치](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/Arrow_functions)가 있습니다. 함수 작성을 연습한 다음에 syntax로 다시 작성하십시오.
## 과제

@ -1,6 +1,6 @@
# Asas JavaScript: Kaedah dan Fungsi
![Asas JavaScript - Fungsi](../images/webdev101-js-functions.png)
![Asas JavaScript - Fungsi](/sketchnotes/webdev101-js-functions.png)
> Sketchnote karya [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuiz Pra Kuliah
@ -104,7 +104,7 @@ displayGreeting('Christopher', 'Hi');
## Nilai Pulangan
Sehingga kini fungsi yang kami bina akan selalu dikeluarkan ke [console](https://developer.mozilla.org/en-US/docs/Web/API/console). Kadang kala inilah yang sebenarnya kita cari, terutamanya ketika kita membuat fungsi yang akan memanggil perkhidmatan lain. Tetapi bagaimana jika saya ingin membuat fungsi pembantu untuk melakukan pengiraan dan memberikan nilai kembali supaya saya dapat menggunakannya di tempat lain?
Sehingga kini fungsi yang kami bina akan selalu dikeluarkan ke [console](https://developer.mozilla.org/docs/Web/API/console). Kadang kala inilah yang sebenarnya kita cari, terutamanya ketika kita membuat fungsi yang akan memanggil perkhidmatan lain. Tetapi bagaimana jika saya ingin membuat fungsi pembantu untuk melakukan pengiraan dan memberikan nilai kembali supaya saya dapat menggunakannya di tempat lain?
Kita boleh melakukan ini dengan menggunakan **nilai kembali**. Nilai kembali akan dikembalikan oleh fungsi, dan dapat disimpan dalam pemboleh ubah sama seperti kita dapat menyimpan nilai literal seperti rentetan atau angka.
@ -133,7 +133,7 @@ const greetingMessage = createGreetingMessage('Christopher');
Semasa anda maju dalam kerjaya pengaturcaraan anda, anda akan menemui fungsi yang menerima fungsi sebagai parameter. Trik rapi ini biasanya digunakan ketika kita tidak tahu kapan sesuatu akan terjadi atau selesai, tetapi kita tahu kita perlu melakukan operasi sebagai tindak balas.
Sebagai contoh, pertimbangkan [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), yang memulakan pemasa dan akan melaksanakan kod apabila selesai. Kita perlu memberitahu apa kod yang ingin kita laksanakan. Kedengarannya pekerjaan yang sempurna untuk fungsi!
Sebagai contoh, pertimbangkan [setTimeout](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), yang memulakan pemasa dan akan melaksanakan kod apabila selesai. Kita perlu memberitahu apa kod yang ingin kita laksanakan. Kedengarannya pekerjaan yang sempurna untuk fungsi!
Sekiranya anda menjalankan kod di bawah ini, setelah 3 saat anda akan melihat mesej **3 saat telah berlalu**.
@ -188,7 +188,7 @@ Bolehkah anda menyatakan dalam satu ayat perbezaan antara fungsi dan kaedah? Men
## Mengkaji & Belajar Sendiri
Perlu [membaca sedikit lebih banyak mengenai fungsi anak panah](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions), kerana ia semakin banyak digunakan dalam pangkalan kod. Berlatih menulis fungsi, dan kemudian menulis semula dengan sintaks ini.
Perlu [membaca sedikit lebih banyak mengenai fungsi anak panah](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/Arrow_functions), kerana ia semakin banyak digunakan dalam pangkalan kod. Berlatih menulis fungsi, dan kemudian menulis semula dengan sintaks ini.
## Tugasan

@ -0,0 +1,195 @@
# JavaScript 入門 - 函式與方法
![JavaScript 入門 - 函式](/sketchnotes/webdev101-js-functions.png)
> 由 [Tomomi Imura](https://twitter.com/girlie_mac) 繪製
## 課前測驗
[課前測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/9?loc=zh_tw)
撰寫程式碼時,我們必須確保程式碼的閱讀性。聽來不太直覺,理解程式碼的時間遠比撰寫時間來的久。裡面最需要被管理的程式項目就是**函式**。
[![函式與方法](https://img.youtube.com/vi/XgKsD6Zwvlc/0.jpg)](https://youtube.com/watch?v=XgKsD6Zwvlc "函式與方法")
> 點擊上方圖片觀看關於函式的影片。
## 函式 (Function)
函式是程式碼區塊,會在程式執行時被呼叫運行。有些時候我們需要重複性的執行同一項作業,比起複製整個邏輯到其他區塊,函式是較完美的處理方式。不只方便維護,也可以在任何地方、任何時間被其他函式呼叫執行。
另一項重點是函式的名稱,聽來不太重要,但它能直接地解釋程式碼的內容。你可以想像它是按鈕上的文字,若按鈕上寫著「停止計時」,你會預期按壓按鈕後會終止計時器的運作。
## 建立並呼叫函式
函式的語法格式如下:
```javascript
function nameOfFunction() { // 函式的定義
// 函式的說明與內容
}
```
如果你想建立一個打招呼的函式,它可能會以下列的格式呈現:
```javascript
function displayGreeting() {
console.log('Hello, world!');
}
```
如果你想呼叫這個函式,我們使用函式的名稱加上 `()`。我們不需要考慮函式是在被呼叫地方的前面或後面才被定義出來JavaScript 的編譯器會幫你尋找它的定義為置。
```javascript
// 呼叫函式
displayGreeting();
```
> **注意** 另一個你正使用的函式類型稱做 **方法(method)**。事實上,我們能在執行 `console.log` 的 demo 時能找到它。它與函式的差異在於它需要接續在物件後面,在這個例子中就是 `console`,而函式並沒有強制要求的。你會發現許多開發者在兩者之間做切換。
### 函式的重點觀念
在建立函式時,你需要注意一些重點:
- 我們反覆提到的,函式的名字要能了解函式的主要功能。
- 使用**駝峰式大小寫(camelCasing)**來連接單字。
- 單一函式只專一在單一功能。
## 向含式傳遞資料
為了讓函式能被重複利用,你會需要餵給函式不同的資料。以上述 `displayGreeting` 的例子中,它只能輸出文字 **Hello, world!**。這並不是個實用的函式。要增加函式的彈性,例如打招呼的對象,我們可以增加新的**參數(parameter/argument)**。它提供額外的資料給函式使用。
參數會寫在定義函式的地方,以括號與逗號標記與分隔:
```javascript
function name(param, param2, param3) {
}
```
現在我們更新函式 `displayGreeting`,讓它支援打招呼的對象:
```javascript
function displayGreeting(name) {
const message = `Hello, ${name}!`;
console.log(message);
}
```
當我們要呼叫函式時,輸入需要的參數在括號中:
```javascript
displayGreeting('Christopher');
// 呼叫完,印出字串 "Hello, Christopher!"
```
## 預設值(Default values)
我們利用參數增加了函式的彈性。但如果我們不想每次都要指定參數給函式使用呢? 繼續之前的例子,保留對象的名稱外,我們增加招呼語的種類。我們可以定義招呼語的預設值,若使用者沒有指定哪一種招呼語時,就使用預設值。它的方法就與賦予變數數值一樣 ── `parameterName = 'defaultValue'`。例如:
```javascript
function displayGreeting(name, salutation='Hello') {
console.log(`${salutation}, ${name}`);
}
```
當我們呼叫函式時,我們可以選擇是否要指定招呼語到 `salutation` 中。
```javascript
displayGreeting('Christopher');
// 輸出字串 "Hello, Christopher"
displayGreeting('Christopher', 'Hi');
// 輸出字串 "Hi, Christopher"
```
## 回傳值(Return values)
目前為止,我們的函式只能輸出字串到[console](https://developer.mozilla.org/en-US/docs/Web/API/console)上。這或許是我們希望的結果,尤其是需要呼叫其他服務的時候。萬一今天我想建立一個額外的函式負責做資料處理與運算呢?
此時,我們可以利用**回傳值**。回傳值由函式輸出,就像變數一樣儲存像是字串或是數字的結果。
如果函式有定義回傳值,那就需要使用關鍵字 `return` 。關鍵字 `return` 需要附帶回傳的數值或是參考物件在後方,如:
```javascript
return myVariable;
```
我們建立一個函式專門建立招呼訊息並回傳給呼叫者:
```javascript
function createGreetingMessage(name) {
const message = `Hello, ${name}`;
return message;
}
```
當函式被呼叫時,變數會儲存函式回傳的數值。這就像我們給變數定值一樣: `const name = 'Christopher'`
```javascript
const greetingMessage = createGreetingMessage('Christopher');
```
## 將函式作為函式參數使用
在你的程式旅程中,你會見到有函式將其他函式當作參數使用。這個俐落的手法常被用在一種情況:我們不知道 A 事件什麼時候發生與完成,但我們要在 A 事件後執行 B 事件。
舉例來說,考慮函式[setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout),它會啟動計時機制,並在倒數完後執行下一個程式。我們需要告訴函式哪一個函式要在時間到後執行,一個完美的例子!
執行下方的程式,三秒鐘之後你會看到訊息**已經過三秒鐘**。
```javascript
function displayDone() {
console.log('已經過三秒鐘');
}
// 計時單位為毫秒。
setTimeout(displayDone, 3000);
```
### 不記名函式(Anonymous functions)
回顧我們所建的函式,這些函式都只被執行了一次。當程式越來越複雜,我們可能建了許多的函式,但他們可能都只被呼叫了一次。這並不是理想的方式,那不如,不要給它函式名稱!
我們可以傳遞函式作為參數使用,也可以直接在參數裡建立新的函式。同樣使用關鍵字 `function`,但我們寫在參數欄當中。
試著以不記名函式的方式改寫程式碼:
```javascript
setTimeout(function() {
console.log('3 seconds has elapsed');
}, 3000);
```
執行上述程式後可以得到相同的結果。我們建立了一個函式,一個沒有名字的函式!
### 箭頭函式(Fat arrow functions)
許多程式語言,包含 JavaScript都有一個常見的快捷語法稱作**箭頭(arrow/fat arrow)**函式。 它使用 `=>` 表示法,就像是箭頭一樣,如同它的名稱!使用 `=>` 可以省略關鍵字 `function`
再一次改寫程式碼,這次我們使用箭頭函式:
```javascript
setTimeout(() => {
console.log('3 seconds has elapsed');
}, 3000);
```
### 使用不同策略的時機
現在你已經學會了三種將函式作為參數的方法了。你可能會好奇使用它們的時機點為何。如果你知道你會重複使用一個函式,請使用正常的方法;如果你知道函式只用在特定的函式內一次,這就是用無記名函式的時機;箭頭函式與傳統 `function` 語法則是取決與你自己,但多數的開發者比較偏好使用 `=>`
---
## 🚀 挑戰
你能用一句話清楚地說明這些函式與方法的差別嗎? 試試看吧!
## 課後測驗
[課後測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/10?loc=zh_tw)
## 複習與自學
這很值得去閱讀[關於箭頭函式的資料](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions),它們越來越常被用在程式碼上。試著寫個函式,再改寫成箭頭語法。
## 作業
[把玩函式](assignment.zh-tw.md)

@ -0,0 +1,13 @@
# Plezier met functies
## Instructies
Maak verschillende functies, zowel functies die iets retourneren als functies die niets retourneren.
Kijk of u een functie kunt maken met een combinatie van parameters en parameters met standaardwaarden.
## Rubriek
| Criteria | Voorbeeldig | Voldoende | Moet worden verbeterd |
| -------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ----------------- |
| | Oplossing wordt geboden met twee of meer goed presterende functies met diverse parameters | Werkoplossing wordt aangeboden met één functie en enkele parameters | Oplossing heeft bugs |

@ -0,0 +1,13 @@
# 把玩函式
## 簡介
建立不同的函式,有的回傳數值,有的不回傳數值。
看看你是否能讓函式有多樣的參數輸入與參數預設值。
## 學習評量
| 作業內容 | 優良 | 普通 | 待改進 |
| -------- | ------------------------------------------ | -------------------------- | -------------- |
| | 建立兩個以上多樣參數輸入且功能豐富的函式。 | 建立一個有參數輸入的函式。 | 函式出現問題。 |

@ -1,6 +1,6 @@
# JavaScript Basics: Making Decisions
![JavaScript Basics - Making decisions](images/webdev101-js-decisions.png)
![JavaScript Basics - Making decisions](/sketchnotes/webdev101-js-decisions.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz
@ -166,7 +166,7 @@ Create a program that is written first with logical operators, and then rewrite
## Review & Self Study
Read more about the many operators available to the user [on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators).
Read more about the many operators available to the user [on MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators).
Go through Josh Comeau's wonderful [operator lookup](https://joshwcomeau.com/operator-lookup/)!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

@ -162,7 +162,7 @@ Erstellen Sie ein Programm, das zuerst mit logischen Operatoren geschrieben wird
## Review & Selbststudium
Lesen Sie mehr über die vielen Operatoren, die dem Benutzer [auf MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators) zur Verfügung stehen.
Lesen Sie mehr über die vielen Operatoren, die dem Benutzer [auf MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators) zur Verfügung stehen.
## Zuordnung

@ -1,5 +1,9 @@
# Conceptos básicos de JavaScript: tomar decisiones
![JavaScript Basics - Making decisions](/sketchnotes/webdev101-js-decisions.png)
> Sketchnote por [Tomomi Imura](https://twitter.com/girlie_mac)
## [Pre-lecture prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/11)
Tomar decisiones y controlar el orden en que se ejecuta su código hace que su código sea reutilizable y robusto. Esta sección cubre la sintaxis para controlar el flujo de datos en JavaScript y su importancia cuando se usa con tipos de datos booleanos.
@ -156,7 +160,7 @@ if (firstNumber > secondNumber) {
## Revisión y autoestudio
Más información sobre los muchos operadores disponibles para el usuario [en MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators).
Más información sobre los muchos operadores disponibles para el usuario [en MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators).
**Asignación**: [Operadores](assignment.es.md)

@ -1,6 +1,6 @@
# Dasar-dasar JavaScript: Membuat Keputusan
![Dasar-dasar JavaScript - Membuat Keputusan](../images/webdev101-js-decisions.png)
![Dasar-dasar JavaScript - Membuat Keputusan](/sketchnotes/webdev101-js-decisions.png)
> Sketsa oleh [Tomomi Imura](https://twitter.com/girlie_mac)
@ -166,7 +166,7 @@ Buat program yang ditulis pertama kali dengan operator logika, lalu tulis ulang
## Review & Belajar Mandiri
Baca lebih lanjut tentang banyak operator yang tersedia untuk pengguna [di MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators).
Baca lebih lanjut tentang banyak operator yang tersedia untuk pengguna [di MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators).
Lihat [pencarian operator](https://joshwcomeau.com/operator-lookup/) oleh Josh Comeau yang luar biasa!

@ -1,6 +1,6 @@
# Nozioni di base su JavaScript: Prendere Decisioni
![Nozioni di base su JavaScript - Prendere decisioni](../images/webdev101-js-decisions.png)
![Nozioni di base su JavaScript - Prendere decisioni](/sketchnotes/webdev101-js-decisions.png)
> Sketchnote di [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz Pre-Lezione

@ -1,6 +1,6 @@
# JavaScript の基本: 意思決定
![JavaScript Basics - Making decisions](../images/webdev101-js-decisions.png)
![JavaScript Basics - Making decisions](/sketchnotes/webdev101-js-decisions.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## レッスン前の小テスト

@ -1,6 +1,6 @@
# JavaScript 기초: 결정하기
![JavaScript Basics - Making decisions](../images/webdev101-js-decisions.png)
![JavaScript Basics - Making decisions](/sketchnotes/webdev101-js-decisions.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## 강의 전 퀴즈
@ -164,7 +164,7 @@ if (firstNumber > secondNumber) {
## 리뷰 & 자기주도 학습
[MDN에서](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators) 사용할 수 있는 많은 연산자에 대해 자세히 알아보십시오.
[MDN에서](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators) 사용할 수 있는 많은 연산자에 대해 자세히 알아보십시오.
Josh Comeau'의 wonderful [operator lookup](https://joshwcomeau.com/operator-lookup/)을 통할 수 있습니다!

@ -1,6 +1,6 @@
# Asas JavaScript: Membuat Keputusan
![Asas JavaScript - Membuat Keputusan](../images/webdev101-js-decisions.png)
![Asas JavaScript - Membuat Keputusan](/sketchnotes/webdev101-js-decisions.png)
> Sketchnote karya [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuiz Pra Kuliah
@ -166,7 +166,7 @@ Buat program yang ditulis terlebih dahulu dengan operator logik, dan kemudian tu
## Mengkaji & Belajar Sendiri
Baca lebih lanjut mengenai banyak pengendali yang ada pada pengguna[pada laman MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators).
Baca lebih lanjut mengenai banyak pengendali yang ada pada pengguna[pada laman MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators).
Lalui laman Josh Comeau tentang [pengendali](https://joshwcomeau.com/operator-lookup/)!

@ -0,0 +1,176 @@
# JavaScript 入門 - 做出決定
![JavaScript 入門 - 做出決定](/sketchnotes/webdev101-js-decisions.png)
> 由 [Tomomi Imura](https://twitter.com/girlie_mac) 繪製
## 課前測驗
[課前測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/11?loc=zh_tw)
為程式碼做決定與控制順序以提高其重複利用性與豐富性。這堂課程提供 JavaScript 的資料流控制語法與布林資料型的重點。
[![做出決定](https://img.youtube.com/vi/SxTp8j-fMMY/0.jpg)](https://youtube.com/watch?v=SxTp8j-fMMY "做出決定")
> 點擊上方圖片以觀賞關於程式做決定的影片。
## 回顧布林資料型
布林只能有兩種數值: `true``false`。 布林幫助程式碼間在特定的條件下做出決定。
設定布林值的方式如下:
`let myTrueBool = true`
`let myFalseBool = false`
✅ 布林的命名來源為一位英格蘭數學家、哲學家暨邏輯學家喬治·布爾 George Boole (18151864)。
## 關係運算子與布林
運算子會被使用在執行比較上,並回傳布林值。以下是常用的運算子列表。
| 符號 | 描述 | 舉例 |
| ----- | -------------------------------------------------------------------------- | ------------------ |
| `<` | **小於** 比較兩數,當左數小於右數時,回傳 `true`。 | `5 < 6 // true` |
| `<=` | **小於等於** 比較兩數,當左數小於右數或左數等於右數時,回傳 `true`。 | `5 <= 6 // true` |
| `>` | **大於** 比較兩數,當左數大於右數時,回傳 `true`。 | `5 > 6 // false` |
| `>=` | **大於等於** 比較兩數,當左數大於右數或左數等於右數時,回傳 `true`。 | `5 >= 6 // false` |
| `===` | **嚴格相等** 比較兩數,當左數等於右數且有相同的資料型態時,回傳 `true`。 | `5 === 6 // false` |
| `!==` | **嚴格不等於** 比較兩數,回傳值與嚴格相等恰恰相反。 | `5 !== 6 // true` |
✅ 藉由在瀏覽器命令欄中撰寫關係運算子來驗證你學到的知識。你有什麼意外發現嗎?
## If 條件式
當條件成立時If 條件式會執行區塊內的程式碼。
```javascript
if (condition){
//Condition was true. Code in this block will run.
}
```
邏輯運算子常被用在建立條件上。
```javascript
let currentMoney;
let laptopPrice;
if (currentMoney >= laptopPrice){
//Condition was true. Code in this block will run.
console.log("Getting a new laptop!");
}
```
## IF..Else 條件式
當條件不成立時,`else` 條件式會執行區塊內的程式碼。它可以和 `if` 條件式選擇性地使用。
```javascript
let currentMoney;
let laptopPrice;
if (currentMoney >= laptopPrice){
// if 條件成立時,這段程式碼會被執行。
console.log("Getting a new laptop!");
}
else{
// else 條件成立時,這段程式碼會被執行。
console.log("Can't afford a new laptop, yet!");
}
```
✅ 在瀏覽器命令欄中測試你是否了解上述程式碼的意義。改變變數 currentMoney 和 laptopPrice 的數值來取得不同的回傳值 `console.log()`
## 邏輯運算子與布林
有時候條件內容包含兩個以上的比較,邏輯運算子可以協助串接比較式來回傳布林值。
| 符號 | 描述 | 舉例 |
| ------ | -------------------------------------------------------------------------- | --------------------------------------------------------- |
| `&&` | **邏輯和** 比較兩個布林條件式,當兩者**皆**回傳 `true` 時,回傳 `true`。 | `(5 > 6) && (5 < 6 ) //左為false、右為true回傳 false。` |
| `\|\|` | **邏輯或** 比較兩個布林條件式,當其中一個回傳 `true` 時,回傳 `true`。 | `(5 > 6) \|\| (5 < 6) //左為false、右為true回傳 true。` |
| `!` | **邏輯非** 回傳布林條件式的相反回傳值。 | `!(5 > 6) // 5 不大於 6但 "!" 讓回傳值為 true。` |
## 邏輯運算子下的決定與條件
邏輯運算子可以用在建立 if..else 條件式中的條件。
```javascript
let currentMoney;
let laptopPrice;
let laptopDiscountPrice = laptopPrice - (laptopPrice * .20) //Laptop price at 20 percent off
if (currentMoney >= laptopPrice || currentMoney >= laptopDiscountPrice){
// if 條件成立時,這段程式碼會被執行。
console.log("Getting a new laptop!");
}
else {
// else 條件成立時,這段程式碼會被執行。
console.log("Can't afford a new laptop, yet!");
}
```
### 否定運算子
你已經了解如何在 `if...else` 條件式中建立條件。任何 `if` 條件需要決定它的是與否。利用運算子 `!`_否定_ 結果。它以下列方式呈現:
```javascript
if (!condition) {
// condition 為 false 時,執行。
} else {
// condition 為 true 時,執行。
}
```
### 條件運算子
`if...else` 並不是唯一表達條件式的方式。你也可以使用名為條件運算子的符號。語法如下:
```javascript
let variable = condition ? <條件成立時回傳 A> : <條件否定時回傳 B>
```
下列是較明確的例子:
```javascript
let firstNumber = 20;
let secondNumber = 10
let biggestNumber = firstNumber > secondNumber ? firstNumber: secondNumber;
```
✅ 花點時間閱讀這段程式碼。你能了解這些運算子的運作方式嗎?
上述的狀態為:
- 若 `firstNumber` 大於 `secondNumber`
- 則賦予 `firstNumber` 數值 `biggestNumber`
- 否則賦予為數值 `secondNumber`
條件運算子的另一種表達方式為:
```javascript
let biggestNumber;
if (firstNumber > secondNumber) {
biggestNumber = firstNumber;
} else {
biggestNumber = secondNumber;
}
```
---
## 🚀 挑戰
建立一個程式,使用邏輯運算式來做判斷,再將程式碼改寫成條件運算子。你喜歡用哪一種語法?
---
## 課後測驗
[課後測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/12?loc=zh_tw)
## 複習與自學
閱讀更多可被使用的運算子:[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators)。
瀏覽 Josh Comeau 所編制的[運算子查詢表](https://joshwcomeau.com/operator-lookup/)
## 作業
[運算子](assignment.zh-tw.md)

@ -0,0 +1,40 @@
# Operatoren
## Instructies
Speel met operatoren. Hier is een suggestie voor een programma dat u kunt implementeren:
U hebt een groep studenten uit twee verschillende beoordelingssystemen.
### Eerste beoordelingssysteem
Een beoordelingssysteem wordt gedefinieerd met cijfers van 1-5, waarbij 3 en hoger betekent dat u slaagt voor de cursus.
### Tweede beoordelingssysteem
Het andere cijfer systeem heeft de volgende cijfers `A, A-, B, B-, C, C-` waarbij `A` het hoogste cijfer is en `C` het laagste voldoende is.
### De taak
Gegeven de volgende array `allStudents` die alle studenten en hun cijfers vertegenwoordigt, construeert u een nieuwe array `studentsWhoPass` met daarin alle studenten die slagen.
> TIP, gebruik een for-loop, if...else en vergelijkingsoperatoren:
```javascript
let allStudents = [
'A',
'B-',
1,
4,
5,
2
]
let studentsWhoPass = [];
```
## Rubriek
| Criteria | Voorbeeldig | Voldoende | Moet worden verbeterd |
| -------- | ------------------------------ | ----------------------------- | ------------------------------- |
| | De complete oplossing wordt gepresenteerd | Gedeeltelijke oplossing wordt gepresenteerd | Oplossing met bugs wordt gepresenteerd |

@ -0,0 +1,41 @@
# 運算子
## 簡介
把玩並熟悉運算子。以下是建議的練習程式模板:
你有兩套提供給同一組學生的成績系統。
### 第一套成績系統
定義分數為 1 到 5。當分數 3 以上時通過測驗。
### 第二套成績系統
定義分數為 `A, A-, B, B-, C, C-` `A` 為最高分而 `C` 為最低分,皆為通過測驗。
### 課題
使用下列矩陣 `allStudents` 表示所有學生的成績,試著建立新的矩陣 `studentsWhoPass` 包含所有通過學生的編號。
> 提示,使用 for-loop 迴圈、 if...else 條件式與比較運算子:
```javascript
let allStudents = [
'A',
'B-',
1,
4,
5,
2
]
let studentsWhoPass = [];
```
## 學習評量
| 作業內容 | 優良 | 普通 | 待改進 |
| -------- | ---------------------- | ------------------------ | ---------- |
| | 提供完整的解答與解釋。 | 只提供部分的解答與解釋。 | 解答有誤。 |

@ -1,6 +1,6 @@
# JavaScript Basics: Arrays and Loops
![JavaScript Basics - Arrays](images/webdev101-js-arrays.png)
![JavaScript Basics - Arrays](/sketchnotes/webdev101-js-arrays.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## Pre-Lecture Quiz
@ -110,7 +110,7 @@ for (let i = 0; i < iceCreamFlavors.length; i++) {
## 🚀 Challenge
There are other ways of looping over arrays other than for and while loops. There are [forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of), and [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Rewrite your array loop using one of these techniques.
There are other ways of looping over arrays other than for and while loops. There are [forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/for...of), and [map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Rewrite your array loop using one of these techniques.
## Post-Lecture Quiz
[Post-lecture quiz](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/14)
@ -118,7 +118,7 @@ There are other ways of looping over arrays other than for and while loops. Ther
## Review & Self Study
Arrays in JavaScript have many methods attached to them, extremely useful for data manipulation. [Read up on these methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) and try some of them out (like push, pop, slice and splice) on an array of your creation.
Arrays in JavaScript have many methods attached to them, extremely useful for data manipulation. [Read up on these methods](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) and try some of them out (like push, pop, slice and splice) on an array of your creation.
## Assignment

@ -109,13 +109,13 @@ for (let i = 0; i < iceCreamFlavors.length; i++) {
## 🚀 Herausforderung
Es gibt andere Möglichkeiten, Arrays als for- und while-Schleifen zu durchlaufen. Es gibt [forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) und [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Schreiben Sie Ihre Array-Schleife mit einer dieser Techniken neu.
Es gibt andere Möglichkeiten, Arrays als for- und while-Schleifen zu durchlaufen. Es gibt [forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/for...of) und [map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Schreiben Sie Ihre Array-Schleife mit einer dieser Techniken neu.
## [Quiz nach der Vorlesung](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/14)
## Review & Selbststudium
An Arrays in JavaScript sind viele Methoden angehängt, die für die Datenmanipulation äußerst nützlich sind. [Informieren Sie sich über diese Methoden](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) und probieren Sie einige davon aus (wie Push, Pop, Slice und Splice). auf einem Array Ihrer Kreation.
An Arrays in JavaScript sind viele Methoden angehängt, die für die Datenmanipulation äußerst nützlich sind. [Informieren Sie sich über diese Methoden](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) und probieren Sie einige davon aus (wie Push, Pop, Slice und Splice). auf einem Array Ihrer Kreation.
## Zuordnung

@ -1,5 +1,8 @@
# Conceptos básicos de JavaScript: matrices y bucles
![JavaScript Basics - Arrays](/sketchnotes/webdev101-js-arrays.png)
> Sketchnote por [Tomomi Imura](https://twitter.com/girlie_mac)
[![Matrices y bucles](https://img.youtube.com/vi/Q_CRM2lXXBg/0.jpg)](https://youtube.com/watch?v=Q_CRM2lXXBg "Matrices y bucles")
@ -87,7 +90,7 @@ while (i < 10) {
}
```
✅ ¿Por qué elegiría un bucle for frente a un bucle while? 17K espectadores tenían la misma pregunta sobre StackOverflow, y algunas de las opiniones [podrían ser interesantes para usted](https://stackoverflow.com/questions/39969145/ while-loops-vs-for-loops-in-javascript).
✅ ¿Por qué elegiría un bucle for frente a un bucle while? 17K espectadores tenían la misma pregunta sobre StackOverflow, y algunas de las opiniones [podrían ser interesantes para usted](https://stackoverflow.com/questions/39969145/while-loops-vs-for-loops-in-javascript).
## Bucles y matrices
@ -103,12 +106,12 @@ for (let i = 0; i < iceCreamFlavors.length; i++) {
✅ Experimente recorriendo una serie de su propia creación en la consola de su navegador.
🚀 Desafío: Hay otras formas de realizar un bucle sobre arreglos además de los bucles for y while. Existen [forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of), y [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Vuelva a escribir su bucle de matriz utilizando una de estas técnicas.
🚀 Desafío: Hay otras formas de realizar un bucle sobre arreglos además de los bucles for y while. Existen [forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/for...of), y [map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Vuelva a escribir su bucle de matriz utilizando una de estas técnicas.
## [Post-lecture prueba](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/14)
## Revisión y autoestudio
Las matrices en JavaScript tienen muchos métodos adjuntos, extremadamente útiles para la manipulación de datos. [Lea sobre estos métodos](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) y pruebe algunos de ellos (como push, pop, slice y splice) en una matriz de su creación.
Las matrices en JavaScript tienen muchos métodos adjuntos, extremadamente útiles para la manipulación de datos. [Lea sobre estos métodos](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) y pruebe algunos de ellos (como push, pop, slice y splice) en una matriz de su creación.
**Asignación**: [Bucle de una matriz](assignment.es.md)

@ -1,6 +1,6 @@
# Dasar-dasar JavaScript: Array dan Loop
![Dasar-dasar JavaScript - Array](../images/webdev101-js-arrays.png)
![Dasar-dasar JavaScript - Array](/sketchnotes/webdev101-js-arrays.png)
> Sketsa oleh [Tomomi Imura](https://twitter.com/girlie_mac)
@ -126,7 +126,7 @@ for (let i = 0; i < rasaRasaEsKrim.length; i++) {
## 🚀 Tantangan
Ada cara lain untuk melakukan perulangan pada array selain perulangan for dan while. Ada [forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of), dan [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Tulis ulang loop array Anda menggunakan salah satu dari teknik ini.
Ada cara lain untuk melakukan perulangan pada array selain perulangan for dan while. Ada [forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/for...of), dan [map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Tulis ulang loop array Anda menggunakan salah satu dari teknik ini.
## Kuis Pasca-Kuliah
@ -134,7 +134,7 @@ Ada cara lain untuk melakukan perulangan pada array selain perulangan for dan wh
## Review & Belajar Mandiri
Array dalam JavaScript memiliki banyak metode yang menyertainya, sangat berguna untuk manipulasi data. [Bacalah tentang metode ini](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) dan coba beberapa di antaranya (seperti push, pop, slice dan splice) pada array kreasi Anda.
Array dalam JavaScript memiliki banyak metode yang menyertainya, sangat berguna untuk manipulasi data. [Bacalah tentang metode ini](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) dan coba beberapa di antaranya (seperti push, pop, slice dan splice) pada array kreasi Anda.
## Tugas

@ -1,6 +1,6 @@
# Nozioni di base di JavaScript: Array e Cicli
![Nozioni di base su JavaScript - Array](../images/webdev101-js-arrays.png)
![Nozioni di base su JavaScript - Array](/sketchnotes/webdev101-js-arrays.png)
> Sketchnote di [Tomomi Imura](https://twitter.com/girlie_mac)
## Quiz Pre-Lezione

@ -1,6 +1,6 @@
# JavaScript の基本: 配列とループ
![JavaScript Basics - Arrays](../images/webdev101-js-arrays.png)
![JavaScript Basics - Arrays](/sketchnotes/webdev101-js-arrays.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## レッスン前の小テスト

@ -1,6 +1,6 @@
# JavaScript 기초: 배열과 반복
![JavaScript Basics - Arrays](../images/webdev101-js-arrays.png)
![JavaScript Basics - Arrays](/sketchnotes/webdev101-js-arrays.png)
> Sketchnote by [Tomomi Imura](https://twitter.com/girlie_mac)
## 강의 전 퀴즈
@ -109,7 +109,7 @@ for (let i = 0; i < iceCreamFlavors.length; i++) {
## 🚀 도전
for문과 while문 외에 배열을 반복하는 다른 방법이 있습니다. [forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) 그리고 [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)도 있습니다. 해당 기술 중 하나를 사용하여 배열 반복을 다시 작성하십시오.
for문과 while문 외에 배열을 반복하는 다른 방법이 있습니다. [forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/for...of) 그리고 [map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map)도 있습니다. 해당 기술 중 하나를 사용하여 배열 반복을 다시 작성하십시오.
## 강의 후 퀴즈
[Post-lecture quiz](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/14?loc=ko)
@ -117,7 +117,7 @@ for문과 while문 외에 배열을 반복하는 다른 방법이 있습니다.
## 리뷰 & 자기주도 학습
JavaScript의 배열에는 많은 메서드를 가져서 데이터 조작에 매우 유용합니다. [이 방법에 대해 읽어보고](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) 만든 배열에서 몇 가지(push, pop, slice 그리고 splice와 같은) 방식을 시도해보십시오.
JavaScript의 배열에는 많은 메서드를 가져서 데이터 조작에 매우 유용합니다. [이 방법에 대해 읽어보고](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) 만든 배열에서 몇 가지(push, pop, slice 그리고 splice와 같은) 방식을 시도해보십시오.
## 과제

@ -1,6 +1,6 @@
# Asas JavaScript: Array dan Loop
![Asas JavaScript - Array](../images/webdev101-js-arrays.png)
![Asas JavaScript - Array](/sketchnotes/webdev101-js-arrays.png)
> Sketchnote karya [Tomomi Imura](https://twitter.com/girlie_mac)
## Kuiz Pra Kuliah
@ -110,14 +110,14 @@ for (let i = 0; i < iceCreamFlavors.length; i++) {
## 🚀 Cabaran
Terdapat cara lain untuk mengulangi tatasusunan selain untuk dan semasa gelung. Terdapat [forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of), dan [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Tulis semula array loop anda menggunakan salah satu teknik ini.
Terdapat cara lain untuk mengulangi tatasusunan selain untuk dan semasa gelung. Terdapat [forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/for...of), dan [map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Tulis semula array loop anda menggunakan salah satu teknik ini.
## Kuiz Pasca Kuliah
[Kuiz Pasca Kuliah](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/14)
## Mengkaji and Belajar Sendiri
Array dalam JavaScript mempunyai banyak kaedah yang melekat padanya, sangat berguna untuk manipulasi data. [Baca kaedah ini](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) dan cuba beberapa di antaranya (seperti push, pop, slice dan splice) pada pelbagai ciptaan anda.
Array dalam JavaScript mempunyai banyak kaedah yang melekat padanya, sangat berguna untuk manipulasi data. [Baca kaedah ini](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) dan cuba beberapa di antaranya (seperti push, pop, slice dan splice) pada pelbagai ciptaan anda.
## Tugasan

@ -0,0 +1,126 @@
# JavaScript 入門 - 矩陣與迴圈
![JavaScript 入門 - 矩陣](/sketchnotes/webdev101-js-arrays.png)
> 由 [Tomomi Imura](https://twitter.com/girlie_mac) 繪製
## 課前測驗
[課前測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/13?loc=zh_tw)
這堂課會包含程式語言 JavaScript建立互動式網頁的基礎。課程中你會學到用來操作資料的矩陣與迴圈。
[![矩陣與迴圈](https://img.youtube.com/vi/Q_CRM2lXXBg/0.jpg)](https://youtube.com/watch?v=Q_CRM2lXXBg "矩陣與迴圈")
> 點擊以上的圖片來觀賞關於矩陣與迴圈的影片。
## 矩陣(Arrays)
處理資料是任何程式語言中最常見的任務,如果能將程式碼有條理地編排成如矩陣的形式,處理任務來會更加輕鬆。矩陣的資料儲存格式就像串列,其中一項好處是矩陣可以儲存不同的資料型態資料。
✅ 矩陣其實圍繞在我們身邊!你能想到現實中那些應用是矩陣的形式,例如太陽能板矩陣嗎?
矩陣的語法需要用到中括號。
`let myArray = [];`
上述為一個空矩陣,矩陣也能在宣告時設定內容資料,資料會以逗號來做區隔。
`let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];`
矩陣數值位置會以**索引(index)**來決定,標記從矩陣的開頭相隔多少元素。在上述例子中,字串 "Chocolate" 的索引為 0"Rocky Road" 為 4。以中括號帶入索引來接收、修改或加入特定元素數值。
✅ 索引從 0 開始有超出你的預料之外嗎?在部分程式語言中,索引會從 1 開始。這有一段有趣的歷史,你可以[閱讀維基百科](https://zh.wikipedia.org/wiki/%E5%BE%9E%E9%9B%B6%E9%96%8B%E5%A7%8B%E7%9A%84%E7%B7%A8%E8%99%9F)來了解它。
```javascript
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
iceCreamFlavors[2]; //"Vanilla"
```
你可以指定索引改變其中的數值,如:
```javascript
iceCreamFlavors[4] = "Butter Pecan"; //Changed "Rocky Road" to "Butter Pecan"
```
或者是指定索引加入新數值,如:
```javascript
iceCreamFlavors[5] = "Cookie Dough"; //Added "Cookie Dough"
```
✅ 另一個常用加入矩陣元素的方式為使用矩陣運算子如 array.push()。
要得知矩陣內有多少元素,可以使用矩陣屬性 `length`
```javascript
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
iceCreamFlavors.length; //5
```
✅ 自己動手試試看!使用瀏覽器命令欄,自由地建立並操控矩陣。
## 迴圈(Loops)
迴圈幫助你處理重複性與**迭代(iterative)**任務,這可以省下許多程式碼行數與時間。每一次迭代可以有不同的變數、數值或條件。在 JavaScript 中有許多種迴圈的樣式,彼此都有些微的差異,但主要功能都一樣:對資料做迴圈。
### For 迴圈(For Loop)
`for` 迴圈有三個條件:
- `計數器(counter)` 一個初始化變數決定目前迭代的次數。
- `條件式(condition)` 一個以比較運算子表示的陳述式,當結果為 `true` 時終止迴圈。
- `迭代陳述式(iteration-expression)` 在每一次迭代完後,改變計數器的數值。
```javascript
// 從 0 加到 10
for (let i = 0; i < 10; i++) {
console.log(i);
}
```
✅ 在瀏覽器命令欄中運行這段迴圈。在改變計數器、條件式與迭代陳述式後有什麼改變?你能讓它變成從 10 減到 0 嗎?
### While 迴圈(While Loop)
不同於 `for` 迴圈語法,`while` 迴圈只要求一個條件式,當條件式回傳 `true` 時即終止迴圈。迴圈中的條件是通常需要依賴像計數器的變數,這些變數必須被合理的處理。計數器的起始化需要在迴圈外面,之後的條件陳述式與計數器的變化則需要在迴圈當中。
```javascript
// 從 0 加到 10
let i = 0;
while (i < 10) {
console.log(i);
i++;
}
```
✅ 你會選擇 for 迴圈還是 while 迴圈呢? 一萬七千個 StackOverflow 用戶問過相同的問題,有些回應[可能會勾起你的興趣](https://stackoverflow.com/questions/39969145/while-loops-vs-for-loops-in-javascript)。
## 矩陣與迴圈
矩陣通常會與迴圈一起出現,大多數的條件式需要矩陣的長度來決定迴圈次數,矩陣的索引值也與計數器的數值相同。
```javascript
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
for (let i = 0; i < iceCreamFlavors.length; i++) {
console.log(iceCreamFlavors[i]);
} // 當所有冰淇淋口味表示完時,結束迴圈。
```
✅ 做個實驗,在瀏覽器命令欄中製作一個使用矩陣的迴圈。
---
## 🚀 挑戰
除了 for 迴圈與 while 迴圈外,仍有許多使用矩陣與迴圈的方法:[forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)、[for-of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of)與[map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)。 用上列其中一種語法改寫你的迴圈。
## 課後測驗
[課後測驗](https://nice-beach-0fe9e9d0f.azurestaticapps.net/quiz/14?loc=zh_tw)
## 複習與自學
在 JavaScript 中,矩陣有許多控制的方法,它們在處理資料上有很大的幫助。
[學習這些方法](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array),如 push、pop、slice 和 splice試著套用在你所創造的矩陣上。
## 作業
[給矩陣的迴圈](assignment.zh-tw.md)

@ -0,0 +1,13 @@
# Loop een Array
## Instructies
Maak een programma dat elk 3de nummer tussen 1 en 20 opsomt en het afdrukt naar de console.
> TIP: gebruik een for-loop en pas de iteratie-uitdrukking aan
## Rubriek
| Criteria | Voorbeeldig | Voldoende | Moet worden verbeterd |
| -------- | --------------------------------------- | ------------------------ | ------------------------------ |
| | Programma loopt correct en wordt becommentarieerd | Programma wordt niet becommentarieerd | Programma is onvolledig of bevat fouten |

@ -0,0 +1,13 @@
# 給矩陣的迴圈
## 簡介
建立一個程式,列出數字每第三個從 1 到 20 的值(3,6,9......),並輸出在 console 上。
> 提示:使用 for-loop 迴圈並改寫它的迭代陳述式。
## 學習評量
| 作業內容 | 優良 | 普通 | 待改進 |
| -------- | -------------------------------------- | ---------------------- | -------------- |
| | 程式完成簡介裡的課題並解釋程式碼意義。 | 程式完成簡介裡的課題。 | 程式出現問題。 |

@ -0,0 +1,14 @@
# Inleiding tot JavaScript
JavaScript is de taal van het web. In deze vier lessen leert u de basisprincipes.
### Onderwerpen
1. [Variabelen en Gegevenstypen](../1-data-types/translations/README.nl.md)
2. [Functies en Methoden](../2-functions-methods/translations/README.nl.md)
3. [Beslissingen nemen met JavaScript](../3-making-decisions/translations/README.nl.md)
4. [Arrays en Lussen](../4-arrays-loops/translations/README.nl.md)
### Credits
Deze lessen zijn geschreven met ♥ door [Jasmine Greenaway](https://twitter.com/paladique), [Christopher Harrison](https://twitter.com/geektrainer) en [Chris Noring](https://twitter.com/chris_noring)

@ -0,0 +1,14 @@
# JavaScript 入門
JavaScript 編輯網頁的一種程式語言。在這四堂課中,你會學到它最基本的知識。
### 主題
1. [變數與資料型態](../1-data-types/translations/README.zh-tw.md)
2. [函式與方法](../2-functions-methods/translations/README.zh-tw.md)
3. [在 JavaScript 做出決定](../3-making-decisions/translations/README.zh-tw.md)
4. [矩陣與迴圈](../4-arrays-loops/translations/README.zh-tw.md)
### 參與人員
這些文章是由 [Jasmine Greenaway](https://twitter.com/paladique)、[Christopher Harrison](https://twitter.com/geektrainer)和[Chris Noring](https://twitter.com/chris_noring) 用滿滿的 ♥️ 來編寫。

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save