Created
October 5, 2016 21:35
-
-
Save kodamirmo/1277e559146f0f30637f1d566125f95a to your computer and use it in GitHub Desktop.
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
var irving = { | |
nombre : 'Irving', | |
edad : 250 | |
}; | |
var javier = { | |
nombre : 'Javier', | |
edad : 50 | |
}; | |
//Devuelve el mas chico | |
function checarEdad (persona1, persona2) { | |
//Terniario | |
return persona1.edad > persona2.edad ? persona2.nombre : persona1.nombre ; | |
} | |
var res = checarEdad(irving, javier); | |
console.log(res); | |
/* | |
Escribir una funcion que | |
classifique los numeros en mayor | |
y menor => { mayor: 5, menor: 2} | |
*/ | |
function clasifica(numero1, numero2) { | |
if (numero1 > numero2) { | |
return { | |
mayor : numero1, | |
menor : numero2 | |
}; | |
} | |
return { | |
mayor : numero2, | |
menor : numero1 | |
}; | |
} | |
console.log(clasifica(5,2)); | |
var amar = function pedrito(persona) { | |
if (persona === 'Mamá') { | |
console.log('Te amo mamá'); | |
} else if (persona === 'Perro') { | |
console.log('Te amo perro'); | |
} | |
}; | |
var querer = amar; | |
amar('Mamá'); | |
amar('Perro'); | |
querer('Mamá'); | |
querer('Perro'); | |
var empresa = { | |
nombre : 'Empresa Patito', | |
direccion : 'Calle 1', | |
telefono : '+5215533466083', | |
nip : 342 | |
}; | |
var cliente = { | |
nombre : 'Enrique Peña', | |
direccion : 'Los Pinos 1', | |
telefono : '+5215533466083', | |
}; | |
var factura = { | |
empresa : empresa, | |
cliente : | |
}; | |
var arreglo = [1, 'dos', {foo : 'bar'}, false]; | |
arreglo.push({foo2: 'bar2'}); | |
//console.log(arreglo); | |
console.log('---------'); | |
//console.log(arreglo[4]); | |
console.log('---------'); | |
console.log(arreglo[4]['foo2']); | |
var objeto = {foo: 'bar'}; | |
console.log(objeto.foo); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment