This file contains hidden or 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
| // BUCLE DO WHILE | |
| var years = 15; | |
| do{ | |
| document.write("Se Ejecutara hasta que years sea 25, year es: "+years+"<br>"); | |
| years++; | |
| // Mientras que years sea menor o igual a 25 se ejecutara | |
| }while(years <= 25); |
This file contains hidden or 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
| // TIPOS DE VENTANAS | |
| // Ventana tipo alerta | |
| alert("Hola, soy una ventana de alerta."); | |
| // Ventana tipo alerta con //Confirmacion | |
| var confirmacion = confirm("Estas seguro de querer continuar?"); | |
| document.write("Haz " +confirmacion+"<br>") | |
| // Ventana tipo Ingreso de datos |
This file contains hidden or 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
| /* | |
| Programa que pida dos numeros y que nos diga cual el mayor, el menor, y si son iguales | |
| PLUS: Si los numeros no son un numero o son menores o iguales a cero, nos lo vuelva a pedir | |
| */ | |
| var num1 = parseInt( prompt("Ingrese un Numero: ") ); | |
| var num2 = parseInt( prompt("Ingrese otro Numero: ") ); | |
| while(num1 <= 0 || num2 <= 0 || isNaN(num1) || isNaN(num2)){ | |
| num1 = parseInt( prompt("Ingrese un Numero correcto: ") ); |
This file contains hidden or 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
| /* | |
| Utilizando un bucle, mostrar la suma y la media de los numeros introducidos | |
| hasta introducir un numero negativo y ahi mostrar el resultado y la media | |
| */ | |
| var suma = 0; | |
| var contador = 0; | |
| do{ | |
| var numero = parseInt( prompt("Introduce numeros hasta que metas uno negativo") ); |
This file contains hidden or 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
| /* | |
| Hacer un programa que muestre todos los numeros entre dos numeros introducidos por el usuario | |
| */ | |
| var num1 = parseInt( prompt('Ingresa un Numero') ); | |
| var num2 = parseInt( prompt('Ingresa Otro numero') ); | |
| document.write("<h1>Numeros entre "+num1+" y "+num2+"</h1><br>") | |
| for(var i=num1; i <= num2; i++){ |
This file contains hidden or 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
| /* | |
| Mostrar todos los numeros impares que hay | |
| entre dos numeros introducidos por el usuario | |
| */ | |
| var num1 = parseInt( prompt("Introduce un numero") ); | |
| var num2 = parseInt( prompt("Introduce otro numero") ); | |
| while(num1 < num2){ | |
| num1++; |
This file contains hidden or 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
| /* | |
| Hacer un programa que nos diga | |
| si un numero es par o impar | |
| */ | |
| var num = parseInt( prompt("Ingresa un Numero") ) | |
| while(isNaN(num)){ | |
| var num = parseInt( prompt("Ingresa un Numero valido") ) | |
| } |
This file contains hidden or 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
| /* | |
| Tablas de multiplicar de un numero introducido | |
| */ | |
| var numero = parseInt( prompt('De que numero quieres la tabla.') ); | |
| while(isNaN(numero)){ | |
| var numero = parseInt( prompt('Introduce un numero correcto, no letras.') ); | |
| } |
This file contains hidden or 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
| /* | |
| Crea un programa que pida dos numeros y muestre los resultados | |
| de la suma, resta, multiplicacion, y la division. | |
| */ | |
| var num1 = parseInt( prompt('Introduce el primer Numero') ) | |
| var num2 = parseInt( prompt('Introduce el segundo Numero') ) | |
| while(num1 < 0 || num2 < 0 || isNaN(num1) || isNaN(num2) ){ | |
| var num1 = parseInt( prompt('Introduce un primer numero correcto') ) |
This file contains hidden or 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
| // FUNCIONES | |
| function calculadora(){ | |
| //Instrucciones | |
| return "Hola soy una calculadora"; | |
| } | |
| // Invocar o llamar a la funcion |