-
-
Save DavidPeralvarez/ce37d1f028094467fd41ef9d76312431 to your computer and use it in GitHub Desktop.
JavaScript - Los arreglos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Curso de Javascript</title> | |
</head> | |
<body> | |
<script src="scripts.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Arreglos */ | |
var arreglo = []; | |
console.log( arreglo ); | |
var listaCompra = [ 'sal', 'salmón', 'pan', 'detergente', 'salsa de soja' ]; | |
console.log( listaCompra ); | |
console.log( listaCompra[3] ); | |
console.log( listaCompra[1] ); | |
console.log( listaCompra.length ); | |
console.log( listaCompra[ listaCompra.length - 1 ] ); | |
var listaRandom = [ | |
'texto', | |
15, | |
{ | |
color: 'rojo', | |
producto: 123123123, | |
tipo: 'camiseta' | |
}, | |
function(){ console.log( 'Mensaje función' ) }, | |
false, | |
[ 1, 2, 3, 4, 5 ] | |
]; | |
console.log( listaRandom[2].producto ); | |
listaRandom[3](); | |
console.log( listaRandom[5][3] ); | |
var listado2 = listaRandom[5]; | |
console.log( listado2 ); | |
listado2[2] = 'hola qué tal'; | |
console.log( listado2 ); | |
console.log( listaRandom ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment