Documentos de Académico
Documentos de Profesional
Documentos de Cultura
<!DOCTYPE html>
<html>
<head>
<title>
Practica En Clases
</title>
<script>
//SE PRACTICAR MAS SOBRE LA NOTACION DE 3PUNTO
//Y SOBRE PARA VER COMO OCTENER UNA FUNCION COMO RESPUESTA
//EJEMPLO N�1 CON EL DOCENTE
let pruducto = (a,b)=>a*b;
let suma = (a,b)=>a+b;
//CREAREMOS UNA VARIABLES QUE NOS ALAMCENE UNA FUNCION
let calculo = function(operacion,arraydatos){
var b;
if(operacion == 1){
b = function(){
let c = arraydatos.reduce(producto,1);
return c;
}
}
else{
b = function(){
let c = arraydatos.reduce(suma,0);
return c;
}
}
return b;
}
let valores = [1,2,3,4,5,6];
let x = calculo(1,valores);
let totalProducto = x();
alert(totalProducto);
alert(pruducto(5,4));
alert(suma(10,20));
</script>
</head>
<body>
<h1> ***PRACTICA 1 EN CLASES*** </h1>
<!--EL PLANCEHOLDER ES UNA LINA DE CODIGO COMO UNA MARCA DE AGUA--
>
</body>
</html>
Código 2
<!DOCTYPE html>
<html>
<head>
<title>
Practica En Clases
</title>
<script>
window.onload= function(){
//COMO FUNCIONAREMOS ESTAS DOS CADENAS APLICANDO LOS TRES PUNT
OS
var frutas = ["Pi�a","Naranja","Mandarina","Pera"];
var personas = ["Juan","Mario","Ana","Pepe"];
var todos = [...frutas, ...personas];
alert(todos.toString());
//METODO MAS SIN APLICAR LOS TRES PUNTOS
//ESTA EN REVISON
//r frutas = ["2","5","3","2"];
//r personas = ["Juan","Mario","Ana","Pepe"];
//r b = frutas.concat(persona);
//ert(b.toString());
//SEGUNDO EJEMPLO
var GuardarLibro = function (titulo,autor,publicacion = "Anonimo
"){
alert("Libro:"+titulo+"\n"+
"Autor:"+autor+"\n"+
"Publicacion:"+publicacion);
}
//primera forma para llamarlo
GuardarLibro("Sangre de Campeon","Rolando Gonslez Perez","Oreill
y");
GuardarLibro("Sangre de Campeon","Rolando Gonslez Perez");
//AHORA APLICAREMOS CON UNA ARRAY
var libro1 =["Campeon","Gonslez Perez","lly"];
var libro2=["Sangre","Rolando ","Orey"];
//AHORA CON EL METODO DE DESEMPAQUETAMIENTO DE TRES PUENTO POD
EMOS APLICAR
GuardarLibro(...libro1);
}
</script>
</head>
<body>
<h1> ***PRACTICA 2 CLASES*** </h1>
<!--EL PLANCEHOLDER ES UNA LINA DE CODIGO COMO UNA MARCA DE AGUA--
>
</body>
</html>
Calculo 3
<!DOCTYPE html>
<html>
<head>
<title>
Practica En Clases
</title>
<script>
let calculo2 = function(operacion, ele1, ele2){
var q;
if(operacion == 1){
q = function(){
let c = ele1 + ele2;
return c;
}
}else if(operacion == 2){
q = function(){
let c = ele1 - ele2;
return c;
}
}else if(operacion == 3){
q = function(){
let c = ele1 * ele2;
return c;
}
}else if(operacion == 4){
q = function(){
let c = ele1 / ele2;
return c;
}
}
return q;
}
let a = calculo2(1,4,4);
let ar = a();
alert("la suma es: "+ar);
let c = calculo2(2,4,4);
let br = c();
alert("la resta es: "+br);
let x = calculo2(3,4,4);
let cr = x();
alert("la multiplicacion es: "+cr);
let w = calculo2(4,4,4);
let wr = w();
alert("la divicion es: "+wr);
</script>
</head>
<body>
<h1> ***PRACTICA 1 EN CLASES*** </h1>
<!--EL PLANCEHOLDER ES UNA LINA DE CODIGO COMO UNA MARCA DE AGUA--
>
</body>
</html>