forked from mouredev/hello-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03-beginner-exercises.js
More file actions
88 lines (70 loc) · 2.26 KB
/
03-beginner-exercises.js
File metadata and controls
88 lines (70 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
Clase 2 en vídeo | 17/07/2024
Tipos de datos, operadores y strings
https://www.twitch.tv/videos/2200149072?t=00h08m02s
*/
// 1. Escribe un comentario en una línea
// Este es un comentario de una sola línea
// 2. Escribe un comentario en varias líneas
/*Este es un comentario
que tiene
varias líneas*/
// 3. Declara variables con valores asociados a todos los datos de tipo primitivos
let tipoString = "Esta es una cadena de texto";
let tipoNumber = 16;
let tipoBoolean = true;
let tipoUndefined;
let tipoNull = null;
let tipoSymbol = Symbol("tipoSymbol");
let tipoBigInt = BigInt(837958374958739487593847398475938753984759387539873798573);
// 4. Imprime por consola el valor de todas las variables
console.log(tipoString);
console.log(tipoNumber);
console.log(tipoBoolean);
console.log(tipoUndefined);
console.log(tipoNull);
console.log(tipoSymbol);
console.log(tipoBigInt);
// 5. Imprime por consola el tipo de todas las variables
console.log(typeof tipoString);
console.log(typeof tipoNumber);
console.log(typeof tipoBoolean);
console.log(typeof tipoUndefined);
console.log(typeof tipoNull);
console.log(typeof tipoSymbol);
console.log(typeof tipoBigInt);
// 6. A continuación, modifica los valores de las variables por otros del mismo tipo
tipoString = "Nuevo valor";
tipoNumber = 85;
tipoBoolean = false;
tipoUndefined = undefined;
tipoNull = null;
tipoSymbol = Symbol("NuevoSymbol");
tipoBigInt = 443878944523115654131453434564513512456458n;
// 7. A continuación, modifica los valores de las variables por otros de distinto tipo
tipoString = 16;
tipoNumber = "esto es un número";
tipoBoolean = undefined;
tipoUndefined = true;
tipoNull = Symbol("otroSymbol");
tipoSymbol = null;
tipoBigInt;
// 8. Declara constantes con valores asociados a todos los tipos de datos primitivos
const nombre = "ignacio";
const edad = 38;
const trabaja = true;
//const esViernes;
const hayHelado = null;
const esSymbol = Symbol("esSymbol");
const esBigInt = BigInt(1234565154656532336546542113514365451413541354555475748889445411);
// 9. A continuación, modifica los valores de las constantes
/*
nombre = "nacho";
edad = 37;
trabaja = false;
esViernes = undefined;
hayHelado = true;
esSymbol = false;
esBigInt = true;
*/
// 10. Comenta las líneas que produzcan algún tipo de error al ejecutarser