-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatatypes.js
More file actions
45 lines (33 loc) · 834 Bytes
/
datatypes.js
File metadata and controls
45 lines (33 loc) · 834 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
//numberdata type
var myNumber = 42;
console.log(myNumber);
console.log(typeof String(myNumber));
console.log(typeof myNumber + "");
//string data type
var myString = "Hello, World!";
console.log(myString);
//boolean data type
var isJavaScriptFun = true;
console.log(isJavaScriptFun);
//undefined data type
var undefinedVar;
console.log(undefinedVar);
//null data type
var nullVar = null;
console.log(nullVar);
// bigint data type
var bigIntVar = 90071992547409911234567873445431n;
console.log(bigIntVar);
console.log(typeof nullVar);
console.log(typeof +myString);
var day = 'Monday';
if(day){
console.log("The vlaue is truthy");
}
else{
console.log("The value is falsy");
}
var myString2 = "123.45";
console.log(parseInt(myString2));
console.log(parseFloat(myString2));
console.log(myString.split(''));