├── JavaScript-Intermedio ├── 1.Objetos │ ├── date.js │ ├── ejercicio.date.js │ ├── ejercicio.js │ ├── ejercicio.math.js │ ├── math.js │ └── objetos.js ├── 2.Array │ ├── array.js │ ├── bucles.js │ └── ejercicio.js ├── 3.Dom │ ├── Dom.html │ └── ejercicio.html ├── 4.eventos │ ├── ejericio.html │ └── eventos.html └── 5.Expresiones-regulares │ └── expresiones_regulares.html ├── LICENSE └── README.md /JavaScript-Intermedio/1.Objetos/date.js: -------------------------------------------------------------------------------- 1 | //toma la fecha actual de nuestro sistema con new date 2 | var date =new date(); 3 | 4 | //obtenemos la fecha actual con horas min y segundos 5 | console.log(date) 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JavaScript-Intermedio/1.Objetos/ejercicio.date.js: -------------------------------------------------------------------------------- 1 | /*Se pide un ejercicio que imprima un mensaje con la fecha 2 | de hoy con el siguiente formato 3 | Hola, hoy es XX del mes XXXX del año YYYY 4 | */ 5 | 6 | var year = date.getFullYear(); 7 | var month = date.getMonth(); 8 | var day = date.getDate(); 9 | 10 | console.log("Hola Hoy es " + day + "del mes " + month + "del año" + year) -------------------------------------------------------------------------------- /JavaScript-Intermedio/1.Objetos/ejercicio.js: -------------------------------------------------------------------------------- 1 | /*Imaginemos que vamos a desarrollar un juego, y 2 | debemos crear un objeto Jugador que tenga una propiedad fuerza 3 | que incialmente tenga el valor 1, un metodo incrementarFuerza que 4 | nos permita incrementar en 1 la fuerza del jugador y un metodo 5 | consultarFuerza que nos muestre un mensaje con la fuerza 6 | del jugador 7 | */ 8 | 9 | var Jugador = { 10 | fuerza : 1, 11 | incrementarFuerza: function(){ 12 | //this.fuerza += 1; //sumar +1 a fuerza 13 | this.fuerza = this.fuerza +1; 14 | }, 15 | consultarFuerza: function(){ 16 | console.log("la fuerza del jugador es: " + this.fuerza) 17 | 18 | } 19 | } 20 | 21 | Jugador.consultarFuerza(); //para ver la fuerza inicial 22 | Jugador.incrementarFuerza() //para incrementar la fuerza 23 | Jugador.consultarFuerza() //la fuerza valdra 2 -------------------------------------------------------------------------------- /JavaScript-Intermedio/1.Objetos/ejercicio.math.js: -------------------------------------------------------------------------------- 1 | /*Escribir una funcion que reciba un numero como parametro 2 | y devuelva un numero aleatorio entre cero y el numero del parametro 3 | ejemoplo: CalcularAleatorio(10) ->devuelve un numero aleatorio 4 | entre 0 y 10 5 | */ 6 | 7 | var aleatorio = Math.random() 8 | 9 | function generarNumero (numeroMaximo){ 10 | return Math.round(Math.random() * numeroMaximo); 11 | } 12 | 13 | //console.log(generarNumnero(100)); 14 | console.log(generarNumnero(10)); 15 | 16 | -------------------------------------------------------------------------------- /JavaScript-Intermedio/1.Objetos/math.js: -------------------------------------------------------------------------------- 1 | //libreria para hacer ciertos calculos con numeros 2 | 3 | //para obtener el valor de Pi (constante) 4 | var pi = Math.PI; 5 | console.log(pi); 6 | 7 | //para obtener el minimo 8 | console.log(Math.min(1,2,4,5,6,7,789,-9,-45)) 9 | console.log(Math.max(1,2,4,5,6,7,789,-9,-45)) 10 | 11 | //para redondear numeros (metodo) 12 | console.log(Math.round(4.5)) //redondea hacia arriba 13 | console.log(mat.round(4.4))///redondea a la baja 14 | console.log(Math.floor(4.8))//con floor se redondea a la baja 15 | console.log(Math.ceil(4.1))//redondea a la alta 5 16 | 17 | //permite generar numeros aleatorios 18 | var aleatorio = Math.random() 19 | console.log(aleatorio) //genera numeros entre 0 y 1 20 | 21 | 22 | -------------------------------------------------------------------------------- /JavaScript-Intermedio/1.Objetos/objetos.js: -------------------------------------------------------------------------------- 1 | var persona = { 2 | nombre : 'Jhon', 3 | edad : 30, 4 | saludar: function (){ 5 | console.log('Hola') 6 | console.log(this.nombre) //acceder al atributo dentro del objeto 7 | console.log("Hola " + this.nombre) //imprime hola Jhon 8 | } 9 | } 10 | 11 | console.log(persona) //imprime el objeto 12 | console.log(persona.nombre) //imprime Jhon 13 | console.log(persona.saludar) //imprime funcion te indica que es una funcion 14 | console.log(persona.saludar()) //imprime los valores de la funcion 15 | persona.saludar(); //imprime el hola de nuestra funcion -------------------------------------------------------------------------------- /JavaScript-Intermedio/2.Array/array.js: -------------------------------------------------------------------------------- 1 | var colores = ["verde", "azul", "rojo"]; 2 | 3 | console.log(colores); //imrpime todo 4 | console.log(colores[1]) //imprime el azul 5 | console.log(colores[0]) //imprime el verde 6 | console.log(colores[2]) //imprime el rojo 7 | console.log(colores[3]) //error undefined 8 | 9 | 10 | //agregar nuevo elementos (push) un nuevo color con el metodo push() 11 | colores.push("negro") 12 | 13 | console.log(colores); 14 | console.log(colores[3]) //ahora tiene el valor de negro 15 | -------------------------------------------------------------------------------- /JavaScript-Intermedio/2.Array/bucles.js: -------------------------------------------------------------------------------- 1 | var colores = ["verde","negro","azul"]; 2 | 3 | //bucle for (inicializacion; condicion a cumplir 4 | //(en array poner .lenght); incremento o decremento) i+=1 5 | for(var i = 0; i <= colores.length; i++ ){ 6 | //todo nuestro codigo 7 | //console.log(i) -> muestra 0,1,2 8 | console.log(colores[1]) //muestra todos los colores 9 | } -------------------------------------------------------------------------------- /JavaScript-Intermedio/2.Array/ejercicio.js: -------------------------------------------------------------------------------- 1 | /* 2 | Ejercicios de array 3 | 1.Muestra los numeros pares del siguiente array 4 | [0,1,2,3,4,5,6,7,8,9,10,11,12] 5 | 6 | 2. Suma todos los numeros del array 7 | [º,1,2,3,4,5,6,7,8,9,10,11,12] 8 | */ 9 | 10 | var num = [0,1,2,3,4,5,6,7,8,9,10,11,12] 11 | for (var i = 0; i <= num.length; i+=1){ 12 | if (i % 2 == 0){ 13 | console.log(i) 14 | } 15 | } 16 | 17 | var numero = [0,1,2,3,4,5,6,7,8,9,10,11,12] 18 | var total = 0; 19 | for (var i = 0; i < numero.length; i+=1){ 20 | total += numero[i]; 21 | } 22 | console.log("El total es: " + total); -------------------------------------------------------------------------------- /JavaScript-Intermedio/3.Dom/Dom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Clase # 2 sobre DOM 4 | 9 | 10 | 11 |

Mi primera clase practica de DOM

12 | 28 | 29 | -------------------------------------------------------------------------------- /JavaScript-Intermedio/3.Dom/ejercicio.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Clase # 2 sobre DOM 5 | 10 | 11 | 12 |

Mi primera clase practica de DOM

13 | 14 | 19 | 55 | 56 | -------------------------------------------------------------------------------- /JavaScript-Intermedio/4.eventos/ejericio.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | Mi primer ejercicio sobre Eventos 10 | 15 | 16 | 17 |

Mi primera clase practica de Eventos

18 | 19 | 20 | 21 | 26 | 88 | 89 | -------------------------------------------------------------------------------- /JavaScript-Intermedio/4.eventos/eventos.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Clase #3 sobre Eventos 6 | 7 | 8 |

Eventos

9 | 10 | 11 | 12 | 13 | 53 | 54 | -------------------------------------------------------------------------------- /JavaScript-Intermedio/5.Expresiones-regulares/expresiones_regulares.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Clase #1 sobre expresiones regulares 4 | 5 |

Expresiones Regulares

6 | 7 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 JCSIVO 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaScript-Intermedio 2 | Demostración de algunas clases sobre JavaScript Intermedio 3 | --------------------------------------------------------------------------------