Arrays JavaScript (arreglos). Declaración, inicialización. Array vacío. length. undefined. Ejemplos (CU01121E)
Aquí esta el ejercicio CU01121E del tutorial básico de programación web con JavaScript:
:)
Código JavaScript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Arrays</title>
<script type="text/javascript">
function array(){
var nombres= [];
nombres[0]= prompt("Escribe un nombre:","Chompy129");
nombres[1]= prompt("Escribe otro nombre:");
nombres[2]= prompt("Escribe un último nombre:");
alert("¡GENIAL!\nLos nombres elegidos son: "+nombres+".");
}
</script>
</head>
<body>
<h1 style="cursor: pointer; outline: 10px solid #555; background-color: #000; color: #FFF; text-align: center; font-family: arial;" onclick="array()">PRESIONAME</h1>
</body>
</html>
Link de la clase: https://www.aprenderaprogramar.com/index.php?option=com_content&view=article&id=799:arrays-javascript-arreglos-declaracion-inicializacion-array-vacio-length-undefined-ejemplos-cu01121e&catid=78:tutorial-basico-programador-web-javascript-desde-&Itemid=206 (https://www.aprenderaprogramar.com/index.php?option=com_content&view=article&id=799:arrays-javascript-arreglos-declaracion-inicializacion-array-vacio-length-undefined-ejemplos-cu01121e&catid=78:tutorial-basico-programador-web-javascript-desde-&Itemid=206)