mirror of
https://github.com/microsoft/Web-Dev-For-Beginners.git
synced 2025-08-11 01:04:08 +02:00
folder names
This commit is contained in:
18
2-js-basics/4-arrays-loops/.github/post-lecture-quiz.md
vendored
Normal file
18
2-js-basics/4-arrays-loops/.github/post-lecture-quiz.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
*Complete this quiz by checking one answer per question.*
|
||||
|
||||
1. What part of a for-loop would you need to modify to increment its iteration by 5
|
||||
|
||||
- [ ] condition
|
||||
- [ ] counter
|
||||
- [ ] iteration-expression
|
||||
|
||||
2. What's the difference between a `while` and a `for-loop`
|
||||
|
||||
- [ ] A `for-loop` has a counter and iteration-expression, where `while` only has a condition
|
||||
- [ ] A `while` has a counter and iteration-expression where `for-loop` only has a condition
|
||||
- [ ] They are the same, just an alias for one another
|
||||
|
||||
3. Given the code `for (let i=1; i < 5; i++)`, how many iterations will it perform?
|
||||
|
||||
- [ ] 5
|
||||
- [ ] 4
|
13
2-js-basics/4-arrays-loops/.github/pre-lecture-quiz.md
vendored
Normal file
13
2-js-basics/4-arrays-loops/.github/pre-lecture-quiz.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
*Complete this quiz in class*
|
||||
|
||||
1. To refer to specific item in an array, you would use a
|
||||
|
||||
- [ ] square bracket `[]`
|
||||
- [ ] index
|
||||
- [ ] curly braces `{}`
|
||||
|
||||
2. How do you get the number of items in an array
|
||||
|
||||
- [ ] The `len(array)` method
|
||||
- [ ] The property `size` on the array
|
||||
- [ ] The `length` property on the array
|
118
2-js-basics/4-arrays-loops/README.md
Normal file
118
2-js-basics/4-arrays-loops/README.md
Normal file
@@ -0,0 +1,118 @@
|
||||
# JavaScript Basics: Arrays and Loops
|
||||
|
||||
[](https://youtube.com/watch?v=Q_CRM2lXXBg "Arrays and Loops")
|
||||
|
||||
## [Pre-lecture quiz](.github/pre-lecture-quiz.md)
|
||||
|
||||
This lesson covers the basics of JavaScript, the language that provides interactivity on the web. In this lesson, you'll learn about arrays and loops, which are used to manipulate data.
|
||||
|
||||
## Arrays
|
||||
|
||||
Working with data is a common task for any language, and it's a much easier task when data is organized in a structural format, such as arrays. With arrays, data is stored in a structure similar to a list. One major benefit of arrays is that you can store different types of data in one array.
|
||||
|
||||
✅ Arrays are all around us! Can you think of a real-life example of an array, such as a solar panel array?
|
||||
|
||||
The syntax for an array is a pair of square brackets.
|
||||
|
||||
`let myArray = [];`
|
||||
|
||||
This is an empty array, but arrays can be declared already populated with data. Multiple values in an array are separated by a comma.
|
||||
|
||||
`let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];`
|
||||
|
||||
The array values are assigned a unique value called the **index**, a whole number that is assigned based on its distance from the beginning of the array. In the example above, the string value "Chocolate" has an index of 0, and the index of "Rocky Road" is 4. Use the index with square brackets to retrieve, change, or insert array values.
|
||||
|
||||
✅ Does it surprise you that arrays start at the zero index? In some programming languages, indexes start at 1. There's an interesting history around this, which you can [read on Wikipedia](https://en.wikipedia.org/wiki/Zero-based_numbering).
|
||||
|
||||
```javascript
|
||||
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
|
||||
iceCreamFlavors[2]; //"Vanilla"
|
||||
```
|
||||
|
||||
You can leverage the index to change a value, like this:
|
||||
|
||||
```javascript
|
||||
iceCreamFlavors[4] = "Butter Pecan"; //Changed "Rocky Road" to "Butter Pecan"
|
||||
```
|
||||
|
||||
And you can insert a new value at a given index like this:
|
||||
|
||||
```javascript
|
||||
iceCreamFlavors[5] = "Cookie Dough"; //Added "Cookie Dough"
|
||||
```
|
||||
|
||||
✅ A more common way to push values to an array is by using array operators such as array.push()
|
||||
|
||||
To find out how many items are in an array, use the `length` property.
|
||||
|
||||
```javascript
|
||||
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
|
||||
iceCreamFlavors.length; //5
|
||||
```
|
||||
|
||||
✅ Try it yourself! Use your browser's console to create and manipulate an array of your own creation.
|
||||
|
||||
## Loops
|
||||
|
||||
Loops allow for repetitive or **iterative** tasks, and can save a lot of time and code. Each iteration can vary in their variables, values, and conditions. There are different types of loops in JavaScript, and they have small differences, but essentially do the same thing: loop over data.
|
||||
|
||||
### For Loop
|
||||
|
||||
The `for` loop requires 3 parts to iterate:
|
||||
- `counter` A variable that is typically initialized with a number that counts the number of iterations.
|
||||
- `condition` Expression that uses comparison operators to cause the loop to stop when `true`
|
||||
- `iteration-expression` Runs at the end of each iteration, typically used to change the counter value
|
||||
|
||||
```javascript
|
||||
//Counting up to 10
|
||||
for (let i = 0; i < 10; i++) {
|
||||
console.log(i);
|
||||
}
|
||||
```
|
||||
|
||||
✅ Run this code in a browser console. What happens when you make small changes to the counter, condition, or iteration expression? Can you make it run backwards, creating a countdown?
|
||||
|
||||
### While loop
|
||||
|
||||
Unlike the syntax for the `for` loop, `while` loops only require a condition that will stop the loop when `true`. Conditions in loops usually rely on other values like counters, and must be managed during the loop. Starting values for counters must be created outside the loop, and any expressions to meet a condition, including changing the counter must be maintained inside the loop.
|
||||
|
||||
```javascript
|
||||
//Counting up to 10
|
||||
let i = 0;
|
||||
while (i < 10) {
|
||||
console.log(i);
|
||||
i++;
|
||||
}
|
||||
```
|
||||
|
||||
✅ Why would you choose a for loop vs. a while loop? 17K viewers had the same question on StackOverflow, and some of the opinions [might be interesting to you](https://stackoverflow.com/questions/39969145/while-loops-vs-for-loops-in-javascript).
|
||||
|
||||
## Loops and Arrays
|
||||
|
||||
Arrays are often used with loops because most conditions require the length of the array to stop the loop, and the index can also be the counter value.
|
||||
|
||||
```javascript
|
||||
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
|
||||
|
||||
for (let i = 0; i < iceCreamFlavors.length; i++) {
|
||||
console.log(iceCreamFlavors[i]);
|
||||
} //Ends when all flavors are printed
|
||||
```
|
||||
|
||||
✅ Experiment with looping over an array of your own making in your browser's console.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 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.
|
||||
|
||||
## [Post-lecture quiz](.github/post-lecture-quiz.md)
|
||||
|
||||
## 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.
|
||||
|
||||
## Assignment
|
||||
|
||||
[Loop an Array](assignment.md)
|
13
2-js-basics/4-arrays-loops/assignment.md
Normal file
13
2-js-basics/4-arrays-loops/assignment.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Loop an Array
|
||||
|
||||
## Instructions
|
||||
|
||||
Create a program that lists every 3rd number between 1-20 and prints it to the console.
|
||||
|
||||
> TIP: use a for-loop and modify the iteration-expression
|
||||
|
||||
## Rubric
|
||||
|
||||
| Criteria | Exemplary | Adequate | Needs Improvement |
|
||||
| -------- | --------------------------------------- | ------------------------ | ------------------------------ |
|
||||
| | Program runs correctly and is commented | Program is not commented | Program is incomplete or buggy |
|
122
2-js-basics/4-arrays-loops/translations/README.de.md
Normal file
122
2-js-basics/4-arrays-loops/translations/README.de.md
Normal file
@@ -0,0 +1,122 @@
|
||||
# JavaScript-Grundlagen: Arrays und Loops
|
||||
|
||||
[](https://youtube.com/watch?v=Q_CRM2lXXBg "Arrays and Loops")
|
||||
|
||||
## [Pre-Lecture Quiz](.github/pre-lecture-quiz.md)
|
||||
|
||||
Diese Lektion behandelt die Grundlagen von JavaScript, der Sprache, die Interaktivität im Web bietet. In dieser Lektion lernen Sie Arrays und Loops kennen, mit denen Daten bearbeitet werden.
|
||||
|
||||
## Arrays
|
||||
|
||||
Das Arbeiten mit Daten ist eine häufige Aufgabe für jede Sprache und eine viel einfachere Aufgabe, wenn Daten in einem strukturellen Format wie Arrays organisiert sind. Bei Arrays werden Daten in einer Struktur ähnlich einer Liste gespeichert. Ein Hauptvorteil von Arrays besteht darin, dass Sie verschiedene Datentypen in einem Array speichern können.
|
||||
|
||||
✅ Arrays sind überall um uns herum! Können Sie sich ein reales Beispiel für ein Array vorstellen, beispielsweise ein Solarpanel-Array?
|
||||
|
||||
Die Syntax für ein Array besteht aus zwei eckigen Klammern.
|
||||
|
||||
`let myArray = [];`
|
||||
|
||||
Dies ist ein leeres Array, aber Arrays können als bereits mit Daten gefüllt deklariert werden. Mehrere Werte in einem Array werden durch ein Komma getrennt.
|
||||
|
||||
`let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];`
|
||||
|
||||
Den Array-Werten wird ein eindeutiger Wert zugewiesen, der als **Index** bezeichnet wird. Diese ganze Zahl wird basierend auf dem Abstand vom Anfang des Arrays zugewiesen. Im obigen Beispiel hat der Zeichenfolgenwert "Chocolate" den Index 0 und der Index "Rocky Road" den Wert 4. Verwenden Sie den Index in eckigen Klammern, um Array-Werte abzurufen, zu ändern oder einzufügen.
|
||||
|
||||
✅ Überrascht es Sie, dass Arrays am Nullindex beginnen? In einigen Programmiersprachen beginnen die Indizes bei 1. Es gibt eine interessante Geschichte, die Sie [auf Wikipedia lesen](https://en.wikipedia.org/wiki/Zero-based_numbering) können.
|
||||
|
||||
|
||||
```javascript
|
||||
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
|
||||
iceCreamFlavors[2]; //"Vanilla"
|
||||
```
|
||||
|
||||
Sie können den Index nutzen, um einen Wert wie folgt zu ändern:
|
||||
|
||||
```javascript
|
||||
iceCreamFlavors[4] = "Butter Pecan"; //ändert "Rocky Road" in "Butter Pecan"
|
||||
```
|
||||
|
||||
And you can insert a new value at a given index like this:
|
||||
|
||||
```javascript
|
||||
iceCreamFlavors[5] = "Cookie Dough"; //"Cookie Dough" hinzugefügt
|
||||
```
|
||||
|
||||
|
||||
✅ Eine häufigere Methode zum Übertragen von Werten in ein Array ist die Verwendung von Array-Operatoren wie array.push()
|
||||
|
||||
Verwenden Sie die Eigenschaft `length`, um herauszufinden, wie viele Elemente sich in einem Array befinden.
|
||||
|
||||
```javascript
|
||||
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
|
||||
iceCreamFlavors.length; //5
|
||||
```
|
||||
|
||||
✅ Probieren Sie es aus! Verwenden Sie die Konsole Ihres Browsers, um ein Array Ihrer eigenen Erstellung zu erstellen und zu bearbeiten.
|
||||
|
||||
## Schleifen
|
||||
|
||||
Schleifen ermöglichen sich wiederholende oder **iterative** Aufgaben und können viel Zeit und Code sparen. Jede Iteration kann in ihren Variablen, Werten und Bedingungen variieren. Es gibt verschiedene Arten von Schleifen in JavaScript, und sie weisen kleine Unterschiede auf, tun jedoch im Wesentlichen dasselbe: Schleifen über Daten.
|
||||
|
||||
### For Loop
|
||||
|
||||
Die `for`-Schleife benötigt 3 Teile, um zu iterieren:
|
||||
- `counter` Eine Variable, die normalerweise mit einer Zahl initialisiert wird, die die Anzahl der Iterationen zählt.
|
||||
- `condition` Ausdruck, der Vergleichsoperatoren verwendet, um zu bewirken, dass die Schleife stoppt, wenn `true`
|
||||
- `iteration-expression` Wird am Ende jeder Iteration ausgeführt und normalerweise zum Ändern des Zählerwerts verwendet
|
||||
|
||||
```javascript
|
||||
//Counting up to 10
|
||||
for (let i = 0; i < 10; i++) {
|
||||
console.log(i);
|
||||
}
|
||||
```
|
||||
|
||||
✅ Führen Sie diesen Code in einer Browserkonsole aus. Was passiert, wenn Sie kleine Änderungen am Zähler, der Bedingung oder dem Iterationsausdruck vornehmen? Können Sie es rückwärts laufen lassen und einen Countdown erstellen?
|
||||
|
||||
### While-Schleife
|
||||
|
||||
Im Gegensatz zur Syntax für die `for` -Schleife erfordern `while`-Schleifen nur eine Bedingung, die die Schleife stoppt, wenn `true`. Bedingungen in Schleifen hängen normalerweise von anderen Werten wie Zählern ab und müssen während der Schleife verwaltet werden. Startwerte für Zähler müssen außerhalb der Schleife erstellt werden, und alle Ausdrücke, die eine Bedingung erfüllen, einschließlich des Änderns des Zählers, müssen innerhalb der Schleife beibehalten werden.
|
||||
|
||||
|
||||
```javascript
|
||||
//Counting up to 10
|
||||
let i = 0;
|
||||
while (i < 10) {
|
||||
console.log(i);
|
||||
i++;
|
||||
}
|
||||
```
|
||||
|
||||
✅ Warum sollten Sie eine for-Schleife oder eine while-Schleife wählen? 17.000 Zuschauer hatten dieselbe Frage zu StackOverflow und einige der Meinungen [könnten für Sie interessant sein](https://stackoverflow.com/questions/39969145/while-loops-vs-for-loops-in-javascript).
|
||||
|
||||
## Schleifen und Arrays
|
||||
|
||||
Arrays werden häufig mit Schleifen verwendet, da die meisten Bedingungen die Länge des Arrays erfordern, um die Schleife zu stoppen, und der Index auch der Zählerwert sein kann.
|
||||
|
||||
|
||||
```javascript
|
||||
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
|
||||
|
||||
for (let i = 0; i < iceCreamFlavors.length; i++) {
|
||||
console.log(iceCreamFlavors[i]);
|
||||
} //Endet, wenn alle Geschmacksrichtungen gedruckt sind
|
||||
```
|
||||
|
||||
✅ Experimentieren Sie mit dem Durchlaufen eines Arrays, das Sie selbst erstellt haben, in der Konsole Ihres Browsers.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 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.
|
||||
|
||||
## [Quiz nach der Vorlesung](.github/post-lecture-quiz.md)
|
||||
|
||||
## 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.
|
||||
|
||||
## Zuordnung
|
||||
|
||||
[Array schleifen](assignment.md)
|
114
2-js-basics/4-arrays-loops/translations/README.es.md
Normal file
114
2-js-basics/4-arrays-loops/translations/README.es.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# Conceptos básicos de JavaScript: matrices y bucles
|
||||
|
||||
[](https://youtube.com/watch?v=Q_CRM2lXXBg "Matrices y bucles")
|
||||
|
||||
|
||||
## [Pre-lecture prueba](.github/pre-lecture-quiz.md)
|
||||
|
||||
Esta lección cubre los conceptos básicos de JavaScript, el lenguaje que proporciona interactividad en la web. En esta lección, aprenderá sobre matrices y bucles, que se utilizan para manipular datos.
|
||||
|
||||
## Matrices
|
||||
|
||||
Trabajar con datos es una tarea común para cualquier lenguaje y es una tarea mucho más fácil cuando los datos están organizados en un formato estructural, como matrices. Con las matrices, los datos se almacenan en una estructura similar a una lista. Uno de los principales beneficios de las matrices es que puede almacenar diferentes tipos de datos en una matriz.
|
||||
|
||||
✅ ¡Las matrices están a nuestro alrededor! ¿Puede pensar en un ejemplo de la vida real de una matriz, como una matriz de paneles solares?
|
||||
|
||||
La sintaxis de una matriz es un par de corchetes.
|
||||
|
||||
`let myArray = [];`
|
||||
|
||||
Esta es una matriz vacía, pero las matrices se pueden declarar ya pobladas con datos. Varios valores en una matriz están separados por una coma.
|
||||
|
||||
`let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];`
|
||||
|
||||
A los valores de la matriz se les asigna un valor único llamado **índice**, un número entero que se asigna en función de su distancia desde el principio de la matriz. En el ejemplo anterior, el valor de cadena "Chocolate" tiene un índice de 0 y el índice de "Rocky Road" es 4. Utilice el índice entre corchetes para recuperar, cambiar o insertar valores de matriz.
|
||||
|
||||
✅ ¿Le sorprende que las matrices comiencen en el índice cero? En algunos lenguajes de programación, los índices comienzan en 1. Hay una historia interesante en torno a esto, que puedes [leer en Wikipedia](https://en.wikipedia.org/wiki/Zero-based_numbering).
|
||||
|
||||
```javascript
|
||||
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
|
||||
iceCreamFlavors[2]; //"Vanilla"
|
||||
```
|
||||
|
||||
Puede aprovechar el índice para cambiar un valor, como este:
|
||||
|
||||
```javascript
|
||||
iceCreamFlavors[4] = "Butter Pecan"; //Se cambió "Rocky Road" a "Butter Pecan"
|
||||
```
|
||||
|
||||
Y puede insertar un nuevo valor en un índice dado como este:
|
||||
|
||||
```javascript
|
||||
iceCreamFlavors[5] = "Cookie Dough"; //Añadida "Cookie Dough"
|
||||
```
|
||||
|
||||
✅ Una forma más común de enviar valores a una matriz es mediante el uso de operadores de matriz como array.push()
|
||||
|
||||
Para saber cuántos elementos hay en una matriz, use la propiedad `length`.
|
||||
|
||||
```javascript
|
||||
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
|
||||
iceCreamFlavors.length; //5
|
||||
```
|
||||
|
||||
✅ ¡Inténtalo tú mismo! Utilice la consola de su navegador para crear y manipular una matriz de su propia creación.
|
||||
|
||||
## Bucles
|
||||
|
||||
Los bucles permiten tareas repetitivas o **iterativas** y pueden ahorrar mucho tiempo y código. Cada iteración puede variar en sus variables, valores y condiciones. Hay diferentes tipos de bucles en JavaScript y tienen pequeñas diferencias, pero esencialmente hacen lo mismo: bucles sobre datos.
|
||||
|
||||
### En bucle
|
||||
|
||||
El ciclo `for` requiere 3 partes para iterar:
|
||||
- `counter` Una variable que normalmente se inicializa con un número que cuenta el número de iteraciones.
|
||||
- `condition` Expresión que usa operadores de comparación para hacer que el bucle se detenga cuando `true`
|
||||
- `iteration-expression` Se ejecuta al final de cada iteración, generalmente se usa para cambiar el valor del contador
|
||||
|
||||
|
||||
```javascript
|
||||
//Contando hasta 10
|
||||
for (let i = 0; i < 10; i++) {
|
||||
console.log(i);
|
||||
}
|
||||
```
|
||||
|
||||
✅ Ejecute este código en una consola de navegador. ¿Qué sucede cuando realiza pequeños cambios en el contador, la condición o la expresión de iteración? ¿Puedes hacer que corra al revés, creando una cuenta regresiva?
|
||||
|
||||
### Bucle while
|
||||
|
||||
A diferencia de la sintaxis para el ciclo `for`, los ciclos `while` solo requieren una condición que detendrá el ciclo cuando sea `true`. Las condiciones en los bucles suelen depender de otros valores, como contadores, y deben gestionarse durante el bucle. Los valores iniciales para los contadores deben crearse fuera del ciclo, y cualquier expresión que cumpla una condición, incluido el cambio del contador, debe mantenerse dentro del ciclo.
|
||||
|
||||
```javascript
|
||||
//Contando hasta 10
|
||||
let i = 0;
|
||||
while (i < 10) {
|
||||
console.log(i);
|
||||
i++;
|
||||
}
|
||||
```
|
||||
|
||||
✅ ¿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
|
||||
|
||||
Las matrices se utilizan a menudo con bucles porque la mayoría de las condiciones requieren la longitud de la matriz para detener el bucle, y el índice también puede ser el valor del contador.
|
||||
|
||||
```javascript
|
||||
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
|
||||
|
||||
for (let i = 0; i < iceCreamFlavors.length; i++) {
|
||||
console.log(iceCreamFlavors[i]);
|
||||
} //Termina cuando se imprimen todos los sabores
|
||||
```
|
||||
|
||||
✅ 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.
|
||||
|
||||
## [Post-lecture prueba](.github/post-lecture-quiz.md)
|
||||
|
||||
## 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.
|
||||
|
||||
**Asignación**: [Bucle de una matriz](assignment.md)
|
13
2-js-basics/4-arrays-loops/translations/assignment.de.md
Normal file
13
2-js-basics/4-arrays-loops/translations/assignment.de.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Schleife ein Array
|
||||
|
||||
## Anleitung
|
||||
|
||||
Erstellen Sie ein Programm, das jede dritte Zahl zwischen 1 und 20 auflistet und auf der Konsole druckt.
|
||||
|
||||
> TIPP: Verwenden Sie eine for-Schleife und ändern Sie den Iterationsausdruck
|
||||
|
||||
## Rubrik
|
||||
|
||||
| Kriterien | Vorbildlich | Angemessen | Verbesserungsbedarf |
|
||||
| -------- | --------------------------------------- | ------------------------ | ------------------------------ |
|
||||
| | Programm läuft korrekt und ist kommentiert | Programm ist nicht kommentiert | Programm ist unvollständig oder fehlerhaft
|
13
2-js-basics/4-arrays-loops/translations/assignment.es.md
Normal file
13
2-js-basics/4-arrays-loops/translations/assignment.es.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Hacer bucle en una matriz
|
||||
|
||||
## Instrucciones
|
||||
|
||||
Cree un programa que enumere cada tercer número entre 1 y 20 y lo imprima en la consola.
|
||||
|
||||
> SUGERENCIA: use un bucle for y modifique la expresión-iteración
|
||||
|
||||
## Rúbrica
|
||||
|
||||
| Criterios | Ejemplar | Adecuado | Necesita mejorar |
|
||||
| -------- | --------------------------------------- | ------------------------ | ------------------------------ |
|
||||
| | El programa se ejecuta correctamente y está comentado | Programa no comentado | El programa está incompleto o con errores |
|
Reference in New Issue
Block a user