Skip to content

Commit f1d3ba3

Browse files
author
Douglas1688
committed
Primer commit de Clase JS
0 parents  commit f1d3ba3

14 files changed

Lines changed: 229 additions & 0 deletions

File tree

clase_1/clase_1.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<script src="clase_1.js"></script>
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>

clase_1/clase_1.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// let num = 5;
2+
// console.log(num*5)
3+
4+
let palabra = "Hola mundo ";
5+
// alert(palabra.length);
6+
// alert(palabra.toLowerCase());
7+
// alert(palabra.toUpperCase());
8+
// alert(palabra.indexOf('mundo'));
9+
// alert(palabra.replace('mundo','Douglas'));
10+
// alert(palabra.substring(5));
11+
// alert(palabra.slice(-1));
12+
// alert(palabra.trim());
13+
14+
15+
// alert(palabra.startsWith('m',5));
16+
// alert(palabra.endsWith(' '))
17+
// alert(palabra.includes('o',-1))
18+
// alert('osi'.repeat(20));
19+
20+
let nombre ,apellido, edad;
21+
nombre = 'Juan';
22+
apellido = 'Gómez';
23+
edad = 20;
24+
alert(`Hola ${nombre} ${apellido}`);
25+
alert(`Tienes ${edad} años.`);

clase_2/clase_2.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<script src="clase_2.js"></script>
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>

clase_2/clase_2.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
console.log(Math.E);
2+
console.log(Math.PI);
3+
let num = 5.9
4+
console.log(Math.abs(num));
5+
console.log(Math.ceil(num));
6+
console.log(Math.floor(num));
7+
console.log(Math.pow(3,3));
8+
console.log(Math.random()*20);
9+
console.log(Math.round(Math.random()*20));
10+
console.log(Math.round(Math.random()*(100-50)+50));
11+
console.log(Math.sign(-3));
12+
console.log(Math.sqrt(36));

clase_3/clase_3.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<script src="clase_3.js"></script>
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>

clase_3/clase_3.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let num = 5;
2+
3+
if (num <3){
4+
console.log("El número es menor que 3.");
5+
}else{
6+
console.log("El número es mayor que 3");
7+
}

clase_4/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
10+
<div id="numbers"></div>
11+
<div id="result"></div>
12+
<script src="script.js"></script>
13+
</body>
14+
</html>

clase_4/script.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const numbers = document.getElementById('numbers');
2+
const result = document.getElementById('result');
3+
4+
let a = prompt('Introduzca el primer número: ');
5+
let b = prompt('Introduzca el segundo número: ');
6+
let c = prompt('Introduzca el tercer número: ');
7+
8+
numbers.textContent = `Los números introducidos son ${a}, ${b}, ${c}`;
9+
10+
if(a>b && a>c){
11+
if(b>c){
12+
result.textContent = `El orden es ${a}, ${b},${c}`
13+
}else{
14+
result.textContent = `El orden es ${a}, ${c},${b}`
15+
}
16+
17+
}
18+
if(b>a&&b>c){
19+
if(a>c){
20+
result.textContent = `El orden es ${b}, ${a},${c}`
21+
}else{
22+
result.textContent = `El orden es ${b}, ${c},${a}`
23+
}
24+
}
25+
if(c>a&&c>b){
26+
if(a>b){
27+
result.textContent = `El orden es ${c}, ${a},${b}`
28+
}else{
29+
result.textContent = `El orden es ${c}, ${b},${a}`
30+
}
31+
32+
}

clase_5/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<script src="script.js"></script>
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
12+
</body>
13+
</html>

clase_5/script.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
let num = 1;
2+
3+
switch (num){
4+
case 1:
5+
console.log("Ha escogido la opción 1");
6+
break;
7+
case 2:
8+
console.log("Ha escogido la opción 2");
9+
break;
10+
default:
11+
console.log("Ninguna opción válida");
12+
}

0 commit comments

Comments
 (0)