Skip to content

Commit 846d161

Browse files
committed
Ejemplos Condicionales
1 parent e4c3a0e commit 846d161

File tree

5 files changed

+61
-3
lines changed

5 files changed

+61
-3
lines changed

condicionales/2.png

101 KB
Loading

condicionales/3.png

67.2 KB
Loading

condicionales/4.png

107 KB
Loading

condicionales/index.html

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<body>
1010
<h1>Condicionales / Operadores Logicos / Operadores Relacionales</h1>
1111

12-
<h1>IF y Operador Igual</h1>
12+
<h1>IF y Operador Igual</h1>
1313

1414
<table>
1515
<h2>Estructura basica</h2>
@@ -27,14 +27,40 @@ <h1>IF y Operador Igual Estricto</h1>
2727
<table>
2828
<h2>Estructura basica</h2>
2929
<td>
30-
<img src="1.png" alt="" width="400">
30+
<img src="2.png" alt="" width="400">
3131
</td>
3232
<td>
3333

3434
<div id="if-estricto"></div>
3535
</td>
3636
</table>
3737

38+
<h1>IF y Operador Logico &&</h1>
39+
40+
<table>
41+
<h2>Estructura basica</h2>
42+
<td>
43+
<img src="3.png" alt="" width="400">
44+
</td>
45+
<td>
46+
47+
<div id="if-opeLogico-Y"></div>
48+
</td>
49+
</table>
50+
51+
<h1>ELSE IF</h1>
52+
53+
<table>
54+
<h2>Estructura basica</h2>
55+
<td>
56+
<img src="4.png" alt="" width="400">
57+
</td>
58+
<td>
59+
60+
<div id="ElseIF"></div>
61+
</td>
62+
</table>
63+
3864
<script src="js.js"></script>
3965
</body>
4066
</html>

condicionales/js.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//If Basico
12
const variableA = 1;
23
const variableB = 1;
34

@@ -9,7 +10,7 @@ if(variableA == variableB){
910
console.log('Las variables son diferentes')
1011
}
1112

12-
13+
//If con operador de igualdad estricto
1314
const variable_Numero = 1;
1415
const variable_Objeto_Numero = new Number(20) ;
1516

@@ -19,4 +20,35 @@ if(variable_Numero === variable_Objeto_Numero){
1920
}else{
2021
document.getElementById('if-estricto').innerHTML = 'Las variables son diferentes';
2122
console.log('Las variables son diferentes')
23+
}
24+
25+
//If con Operador logico &&
26+
27+
const varIFA = 20;
28+
const varIFB = 20;
29+
30+
const varIFD = 10;
31+
const varIFE = 15;
32+
33+
if( (varIFA === varIFB) && (varIFD === varIFE) ){
34+
document.getElementById('if-opeLogico-Y').innerHTML = 'Las variables son iguales';
35+
console.log('Son iguales');
36+
}else{
37+
document.getElementById('if-opeLogico-Y').innerHTML = 'Las variables son diferentes';
38+
console.log('Son diferentes');
39+
}
40+
41+
//ELSE IF
42+
43+
const varELSEA = 'Hola';
44+
const varELSEB = 'Adios';
45+
46+
const varELSEC = 'Hola';
47+
48+
if(varELSEA == varELSEB){
49+
document.getElementById('ElseIF').innerHTML = 'Son iguales varELSEA y varELSEB';
50+
console.log('Son iguales varELSEA y varELSEB');
51+
}else if( varELSEA == varELSEC){
52+
document.getElementById('ElseIF').innerHTML = 'Son iguales varELSEA y varELSEC';
53+
console.log('Son iguales varELSEA y varELSEC');
2254
}

0 commit comments

Comments
 (0)