Commit 419974b2 by Jose Figueredo

Js 001

parents
Ejercicios cada uno con su nombre, prueba3.html va con eje3y4
\ No newline at end of file
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));
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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="eje1.js">
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="eje2.js"></script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="eje3y4.js"></script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment