Documentos de Académico
Documentos de Profesional
Documentos de Cultura
RTA: Dentro de la fila hay diversos elementos los cuales podemos llamarlos respecto al número y
la posición en la que este se encuentre.
2. Ejemplo:
Crea un arreglo llamado myArray y luego muestra algunos elementos de ciertas posiciones del
array
// first element
console.log(myArray[0]); // "h"
// second element
console.log(myArray[1]); // "e"
// último elemento
console.log(myArray[4]); //o
myArray.push('q');
console.log(myArray);
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Arrye</title>
</head>
<body>
<script>
const myArray = ["h", "e", "l", "l", "o"];
alert(myArray[0]);
alert(myArray[1]);
alert(myArray[4]);
myArray.unshift("m");
myArray.push("c");
alert(myArray);
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pop</title>
</head>
<body>
<script>
const ensalada = ["🥕", "🥒", "🥑", "🍄", "🌽", "🍅", "🥦"];
ensalada.pop(); // 🥕
https://www.freecodecamp.org/espanol/news/el-manual-de-arreglos-en-javascript/
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shift</title>
</head>
<body>
<script>
const ensalada = ["🥕", "🍄", "🥦", "🥒", "🌽", "🍅", "🥑"];
ensalada.shift(); // 🥕
CARRO EJERCICIO 1
<!DOCTYPE html>
Arreglos en Js -funciones
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Carros</title>
</head>
<body>
<script>
const Carro = [
"FERRARI",
"SUZUKI",
"NISSAN",
"TOYOTA",
"FORD",
"BMW",
"CHEVROLET",
];
Carro.shift();
Carro.pop();
alert(Carro[0]);
alert(Carro[2]);
alert(Carro[3]);
alert(Carro[5]);
Carro.unshift("HONDA");
alert(Carro);
</script>
</body>
</html>
CARRO EJERCICIO 2
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Carros</title>
</head>
<body>
<script>
const Carro = [
"BMW",
"MAZDA",
Arreglos en Js -funciones
"NISSAN",
"TOYOTA",
"FORD",
"CHEVROLET",
"HONDA",
];
Carro.shift();
Carro.pop();
Carro.unshift("SUZUKI");
Carro.forEach((element) => alert(element));
alert(Carro);
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>forEach</title>
</head>
<body>
<script>
const array1 = ["alo", "@", "", "55", "4,5", "&&", "f"];
array1.forEach((element) => alert(element));
</script>
</body>
</html>
5. Defina que es una matriz o arreglo bidimensional, observe la imagen y explique el concepto
Arreglos en Js -funciones
R: El elemento está compuesto de diferentes filas y columnas en las cuales podemos almacenar
datos y llamarlos según su posición.
<body>
<script>
const Matriz = [
[4, 2],
[1, 3],
];
console.table(Matriz);
</script>
</body>
</html>
<body>
<script>
function triangulo() {
alert("Especifique las medidas del triangulo");
l1 = prompt("digite el lado 1");
l2 = prompt("digite el lado 2");
l3 = prompt("digite el lado 3");
if (l1 == l2 && l2 == l3 && l3 == l1) {
alert("Su triángulo es equilatero");
} else if (l1 !== l2 && l2 !== l3 && l3 !== l1) {
alert("Su triángulo es escaleno");
} else {
alert("Su triángulo es isoceles");
}
}
triangulo();
</script>
</body>
Arreglos en Js -funciones
</html>
INFORME
Pues lo que hicimos esta guía no enseña el uso del (MyArrive) que nos
permite facilitarnos el llamar datos que están almacenados en este, Y
también sirve en otras funciones como el JavaScript las cuales nos facilitan
mucho más el código, y (Unshift) el cual nos ayuda agregar otros elementos
dentro del (Arrive) y también el (Pop) y (Shift) que permite quitar el ultimo
elemento que se encuentra a diferencia del shift el cual quita el primer
elemento, también utilizando el (ForEach) el cual nos ayuda mostrar todos lo
valores que se encuentran, y el ultimo utilizamos la (matriz) el cual nos deja
Arreglos en Js -funciones
en un orden los objetos que deleguemos dentro de este código para tener
una organización y ya para terminar utilizamos algunos de estos atributos de
(JS) para realizar el ultimo ejercicio el cual nos facilito y nos ahorró líneas de
código.