From 419974b271c9063144f0fd31493adb8a8f2b8d5c Mon Sep 17 00:00:00 2001 From: Jose Figueredo Date: Thu, 3 Sep 2020 20:46:29 -0400 Subject: [PATCH] Js 001 --- Readme.md | 1 + eje1.js | 38 ++++++++++++++++++++++++++++++++++++++ eje2.js | 21 +++++++++++++++++++++ eje3y4.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ prueba.html | 15 +++++++++++++++ prueba2.html | 11 +++++++++++ prueba3.html | 13 +++++++++++++ 7 files changed, 149 insertions(+) create mode 100644 Readme.md create mode 100644 eje1.js create mode 100644 eje2.js create mode 100644 eje3y4.js create mode 100644 prueba.html create mode 100644 prueba2.html create mode 100644 prueba3.html diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..9b865f0 --- /dev/null +++ b/Readme.md @@ -0,0 +1 @@ +Ejercicios cada uno con su nombre, prueba3.html va con eje3y4 \ No newline at end of file diff --git a/eje1.js b/eje1.js new file mode 100644 index 0000000..b402130 --- /dev/null +++ b/eje1.js @@ -0,0 +1,38 @@ + + + + + +var x= Math.floor(Math.random() * 100); +var y= Math.floor(Math.random() * 100); + + + +function suma (a,b){ + return a+b; +} + +function multiplicar(a,b){ + return a*b; +} + +function potencia(a,b){ + return a**b; +} + +function dividir(a,b){ + return a/b; +} + +function resto(a,b){ + return a%b; +} + +var x= Math.floor(Math.random() * 100); +var y= Math.floor(Math.random() * 100); + +console.log("X es "+x+"y es "+y); + + +var s = console.log("Suma: "+suma(x,y)); + diff --git a/eje2.js b/eje2.js new file mode 100644 index 0000000..38051d0 --- /dev/null +++ b/eje2.js @@ -0,0 +1,21 @@ + +var x= Math.floor(Math.random() * 100); +var y= Math.floor(Math.random() * 100); +var z= Math.floor(Math.random() * 100); + +console.log(x+ " "+y+" "+z); + +raices(x,y,z); + + +function raices(a,b,c){ + + var x1= (-1*b)+Math.sqrt(b**2 -4*a*c); + var x2= (-1*b)-Math.sqrt(b**2 -4*a*c); + + x1= x1/(2*a); + x2=x2/(2*a); + + console.log("Las raices son: "+x1+" "+x2); + +} \ No newline at end of file diff --git a/eje3y4.js b/eje3y4.js new file mode 100644 index 0000000..2a4d950 --- /dev/null +++ b/eje3y4.js @@ -0,0 +1,50 @@ + +var a=120,b=60; + var rad_a = rad(a); + var rad_b = (Math.PI/180)*b; + + + +sena= Math.sin(rad_a); +cosb= Math.sin(rad_b); +console.log(sena-cosb); + + +sena= Math.sin(rad(90)); +cosb= Math.cos(rad(10)); + +var resta = sena**2 - cosb**2; + +console.log(resta); + + + + +function rad(n){ + return (Math.PI/180)*n +} + + +// Strings + +// para acceder a un caracter charAt(i); + +var s="ES una prueba"; + +var a = s.charAt(1); + +// para convertir a nunmerico + +a = parseInt(s); + +// para poner en mayusculas + +s = s.toUpperCase(); + +// para saber su long + +var nnn= s.indexOf(); + +// para remplazar a por b + +s.replace("a","b"); \ No newline at end of file diff --git a/prueba.html b/prueba.html new file mode 100644 index 0000000..4a84a2e --- /dev/null +++ b/prueba.html @@ -0,0 +1,15 @@ + + + + + + Document + + + + + + + \ No newline at end of file diff --git a/prueba2.html b/prueba2.html new file mode 100644 index 0000000..c472469 --- /dev/null +++ b/prueba2.html @@ -0,0 +1,11 @@ + + + + + + Document + + + + + \ No newline at end of file diff --git a/prueba3.html b/prueba3.html new file mode 100644 index 0000000..f34fb52 --- /dev/null +++ b/prueba3.html @@ -0,0 +1,13 @@ + + + + + + Document + + + + + + + \ No newline at end of file -- libgit2 0.26.0