Created
July 5, 2018 20:26
-
-
Save luisfarfan/70dd58466c2912e7b5eb65a773fa08f2 to your computer and use it in GitHub Desktop.
Revisions
-
luisfarfan created this gist
Jul 5, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ // Uso de Let y Const // var nombre = "César Tapia"; // var edad = 32; // var PERSONAJE = { // nombre: nombre, // edad: edad // }; // Resolución 1: /** envolvi esta resolución para que no cause conflictos con la Resolución 2 */ (() => { const nombre = "Cesar Tapia"; const edad = 32; let Personaje = { nombre: nombre, edad: edad, } console.log(Personaje); })(); // Resolución 2: const nombre = "Cesar Tapia"; const edad = 32; class Personaje { constructor(nombre: string, edad: number) { } } new Personaje(nombre, edad); // Cree una interfaz que sirva para validar el siguiente objeto // var batman = { // nombre: "Bruno Díaz", // artesMarciales: ["Karate", "Aikido", "Wing Chun", "Jiu-Jitsu"] // } // Resolución: interface ISuperHero { nombre: string; artesMarciales: string[]; } let batman: ISuperHero = { nombre: "Bruno Diaz", artesMarciales: ["Karate", "Aikido", "Wing Chun", "Jiu-Jitsu"] }; // Convertir esta función a una función de flecha // function resultadoDoble(a, b) { // return (a + b) * 2 // } const resultadoDoble = (a, b) => (a + b) * 2;