This repository was archived by the owner on Aug 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path2-types.js
More file actions
137 lines (115 loc) · 4.52 KB
/
2-types.js
File metadata and controls
137 lines (115 loc) · 4.52 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**
@description
Javascript variables have weak typing, this is can assume any state
in the course of execution, where they may have dynamic types or data types.
Dynamic types
The dynamic types used in javascript are:
@argument number
@description
Represents a number-type variable.
@argument string
@description
Represents a text-type variable.
@argument boolean
@description
Represents a logical type variable.
@argument number
Variable @var {number} numberVar receives a number and assumes the type number.
@argument typeof shows the type of data that the.
@example
**/
var numberVar = 0;
console.log(numberVar); // 0
console.log(typeof numberVar); // number
/**
@argument string
Variable @var {string} strVar receives a text and assumes the string type.
@example
**/
var strVar = "Hello types";
console.log(strVar); // Hello types
console.log(typeof strVar); // string
/**
@argument boolean
Váriavel @var {boolean} logicVar receives a logical assignment true and assumes the boolean type.
@example
**/
var logicVar = true;
console.log(logicVar); // true
console.log(typeof logicVar); // boolean
/**
Primitive data types
The primitive data types used in javascript are:
@argument Boolean
@description
Represents a data in the boolean type variable, where the logical conditions true and false can be assigned.
@argument Null
@description
Represents a data in the null-type variable, where it is considered null or invalid.
@argument Undefined
@description
Represents a data in the variable of type undefined, where it is considered indefinite.
@argument Number
@description
Represents a data in the number type variable,
where any number between
- (2 ^ 53-1) and (2 ^ 53-1), and three symbolic types:
@argument + Infinity, means a positive infinite number.
@argument -Infinity means a negative infinite number.
@argument NaN, which means is not a number.
@argument String
@description
Represents a data in the string-type variable,
where any kind of text surrounded by "", "or" is considered.
**/
/**
@argument Boolean
Variable @var {boolean} logicVar as already stated in this document, this will be reused,
receiving a logical assignment false and assumes the boolean type.
@example
**/
console.log(logicVar); // true
logicVar = false;
console.log(logicVar); // false
console.log(typeof logicVar); // boolean
/**
@argument Null
Variable @var {object} nullVar gets an null assignment.
@example
**/
var nullVar = null;
console.log(nullVar); // false
console.log(typeof nullVar); // object
/**
@argument Undefined
Variable @var {undefined} undefinedVar not assigning value to a variable that becomes undefined.
@example
**/
var undefinedVar;
console.log(undefinedVar); // undefined
console.log(typeof nullVar); // undefined
/**
@argument Number
Variable @var {number} numberVar as already stated in this document, it will be reused, receiving a new number.
@example
**/
console.log(numberVar); // 1
numberVar = 0;
console.log(numberVar); // 1
console.log(typeof numberVar); // number
console.log(typeof Infinity); // number
console.log(typeof -Infinity); // number
console.log(typeof NaN); // number
/**
@argument String
Variable @var {string} strVar as already stated in this document, it will be reused, receiving a new text.
@example
**/
console.log(strVar); // Hello types
strVar = "Hello primitive value";
console.log(strVar); // Hello primitive value
console.log(typeof strVar); // string
/**
Object type
There is also the type @argument object, this being more complex will be treated in a separate file.
**/