-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdatatypes.js
More file actions
50 lines (33 loc) · 796 Bytes
/
datatypes.js
File metadata and controls
50 lines (33 loc) · 796 Bytes
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
// 7 datatypes in javascript
//Boolean
var flag = true
if(flag){
console.log("hurrah its true")
} else {
console.log("hurrah its false")
}
//null
var myNumber = null
console.log(myNumber + 5)
//null is always treated as zero
//undefined
var myNumber;
console.log(myNumber + 5) //NAN
//Number
var number1 = 12
var number2 = 13
console.log(number1 + number2)
//String
var message = "Hello welcome to the first workshop"
console.log(message)
//Symbol
//es6 date type instances are unique and immutable
var symbol1 = Symbol('manjula')
var symbol2 = Symbol('manjula')
console.log(symbol1 === symbol2)
/**convert it to <string></string> */
console.log(String(symbol1) === String(symbol2)
//Object
var myObject = new Object();
myObject.name = "Manjula"
console.log(myObject.name)