-
Notifications
You must be signed in to change notification settings - Fork 1
/
apuntes jabascrp.js.txt
81 lines (57 loc) · 2.31 KB
/
apuntes jabascrp.js.txt
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
///VARIABLES///
VAR // variable global *obsoleta
//VARIABLES DE BLOQUE
CONST // "variable" NO MODIFICABLE
LET // variable modoficable
//tipos de variables{
String "hola",'mundo' //texto TAMBIEN LLAMADO CADENA (POR ESO LA SUMA DE PALABRAS ES CONCATENADO)
Boolean // verdadero o falso /binario 1 o 0
Number // ovbio mumeros 23
Number float:0.23 // coma flotante / numero
// }
/// TERMINAL ///
console.log // imprime en la Terminal *util para inspeccionar codigo
//fallos
null //valor nulo
undefined //valor infedinido
NaN //no es un numero / Not a Number
/// operaciones ///
// aritmetica (MATEMATICAS)
+ //SUMA
- //RESTA
* //MILTIPLICACION
/ //dividir
% // el resto de una division
///comparadores
// < > // mayor/menor que 5>8=false
<= => // menor o igual/mayor o igual
== //igual pero pueden ser distintos tipos del mismo valor
=== // extrictamente igual de tipo y valor
/// condiciones ///
if (condition) { //ENTONCES
// código a ejecutar si la condición es verdadera
}
else {
// código a ejecutar si la condición es falsa
}
if (condition1) {
// código a ejecutar si la condition1 es verdadera
} else if (condition2) {
// código a ejecutar si la condition2 es verdadera
} else {
// código a ejecutar si ninguna de las condiciones anteriores es verdadera
}
/// logica
&& //AND /Y
|| //OR /ó
! //NOT /no negacion
//comparadores
// < > mayor/menor que 5>8=false
<= => // menor/mayor o igual
== //igual pero pueden ser distintos tipos del mismo valor
=== // extrictamente igual de tipo y valor
// funciones
// function test(){}
let age = prompt('What is your age?');
// Your code below:
console.log(parseInt(age) + 10); /// cambia de string a numero y suma lueeeh