Skip to content

Commit 2944ef7

Browse files
committed
2 parents 5adab1f + ade7dff commit 2944ef7

File tree

16 files changed

+2280
-837
lines changed

16 files changed

+2280
-837
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// URL del sitio web oficial de JavaScript: https://developer.mozilla.org/es/docs/Web/JavaScript
2+
3+
// Este es un comentario en línea
4+
5+
/* Y esta es la manera
6+
en la que se hacen comentarios
7+
en varias líneas */
8+
9+
// Creación de variable y constante
10+
11+
let variable = "variable"
12+
var variable2 = "variable 2"
13+
const constante = "constante"
14+
15+
// Variables representando los tipos de datos primitivos
16+
17+
let cadenaTexto = "Cadena de texto"
18+
let entero = 0
19+
let booleano = true
20+
let nulo = null
21+
let indefinido = undefined
22+
23+
24+
// Imprimir por terminal
25+
26+
console.log("¡Hola, JavaScript!");
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#https://www.python.org
2+
3+
#comentario de linea
4+
5+
'comentario en lineas'
6+
7+
"otra forma de comentar"
8+
9+
variable = "una variable"
10+
11+
CONSTANTE = "Constante ya que python no las maneja literalmente"
12+
13+
print (type("Andres"))
14+
print (type(10))
15+
print (type(3.14))
16+
print (type(1+1j))
17+
print (type(True))
18+
print (type ([1,2,3,4]))
19+
print (type({'name':'andres', 'age':22, 'casado': False}))
20+
print (type((1,2)))
21+
print (type(zip([1,2],[3,4])))
22+
23+
print ("Hola, Python!")
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# https://www.python.org/
2+
3+
# estoy estudiando
4+
5+
"""
6+
todo lo
7+
que escribo
8+
es un
9+
comentario
10+
"""
11+
12+
'''
13+
todo lo
14+
que escribo
15+
es un
16+
comentario
17+
'''
18+
19+
carros = 3
20+
carros = 9
21+
22+
GALLINERO = 2
23+
24+
mi_entero = 10
25+
mi_decimal = 4.8
26+
my_bool = True
27+
my_bool = False
28+
mi_cadena = "mi cadena de texto"
29+
30+
print ("Hola,[python]")
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# https://www.python.org/
2+
# esto si es un comentario
3+
"""
4+
yo pongo
5+
muchos
6+
comentaros
7+
"""
8+
9+
'''
10+
hacer
11+
muchos
12+
comentarios
13+
'''
14+
bosques = 12000
15+
bosques = 45000
16+
17+
BOSQUES = 51000
18+
19+
mientero = 60
20+
miflotante = 63.9
21+
micadena = " Python de isaac"
22+
mibool = True
23+
mibool = False
24+
imprime = mientero + miflotante
25+
print ("Hola (python)")
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// DATOS POR VALOR Y REFERENCIA
2+
var a = 10;
3+
var b = a;
4+
a = 20;
5+
6+
console.log(b); // 10
7+
console.log(a); // 20
8+
9+
var c = [10, 20];
10+
var d = c;
11+
d.push(30);
12+
13+
console.log(d);
14+
console.log(c);
15+
16+
// FUNCIONES CON DATOS POR VALOR
17+
18+
var h = 10;
19+
20+
function my_valor(my_va) {
21+
my_va = 20;
22+
console.log(my_va);
23+
}
24+
25+
my_valor(h); // 20
26+
console.log(h); // 10
27+
28+
// FUNCIONES CON DATOS POR REFERENCIA
29+
30+
// var j = [10, 20];
31+
32+
// function my_referencia(my_re) {
33+
// my_re.push(30);
34+
// console.log(my_re);
35+
// }
36+
37+
// my_referencia(j);
38+
// console.log(j);
39+
40+
// EJERCICIO DE VALOR
41+
function intercambioPorValor(a, b) {
42+
let temp = a;
43+
a = b;
44+
b = temp;
45+
return [a, b];
46+
}
47+
48+
// Definimos variables originales
49+
let valor1 = 10;
50+
let valor2 = 20;
51+
52+
// Llamamos a la función para intercambiar los valores
53+
let nuevosValores = intercambioPorValor(valor1, valor2);
54+
55+
// Imprimimos los valores originales y los nuevos
56+
console.log(valor1, valor2);
57+
console.log(nuevosValores[0], nuevosValores[1]);
58+
59+
// EJERCICIO DE REFERENCIA
60+
function interPorRef(c, d) {
61+
let temp = c;
62+
c = d;
63+
d = temp;
64+
d.push(50);
65+
66+
return [c, d];
67+
}
68+
69+
var valor3 = [10, 20];
70+
var valor4 = [30, 40];
71+
72+
let nuevoValor2 = interPorRef(valor3, valor4);
73+
console.log(valor3, valor4);
74+
console.log(nuevoValor2[0], nuevoValor2[1]);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// EJERCICIO
2+
function countDown(number) {
3+
console.log(number);
4+
if (number === 1) {
5+
// Este es el caso base
6+
console.log("Boom!");
7+
} else {
8+
// Esta es la llamada recursiva
9+
return countDown(number - 1);
10+
}
11+
}
12+
13+
countDown(100);
14+
15+
// EJERCICIO OPCIONAL 1
16+
function factorial(numero) {
17+
if (numero === 0) {
18+
return 1;
19+
} else {
20+
return numero * factorial(numero - 1);
21+
}
22+
}
23+
24+
factorial(10);
25+
console.log(factorial(10));
26+
27+
// EJERCICIO OPCIONAL 2
28+
function fibonacci(n) {
29+
if (n < 0) {
30+
console.log("La posición tiene que ser mayor que cero");
31+
return 0;
32+
} else if (n == 1) {
33+
return 0;
34+
} else if (n == 2) {
35+
return 1;
36+
} else {
37+
return fibonacci(n - 1) + fibonacci(n - 2);
38+
}
39+
}
40+
41+
console.log(fibonacci(10));

0 commit comments

Comments
 (0)