-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut4.js
More file actions
62 lines (53 loc) · 1.31 KB
/
tut4.js
File metadata and controls
62 lines (53 loc) · 1.31 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
// Data types in Java Script
/* Primitive data type - stack - like static
string
numbers
boolean
null
undefined
symbol
*/
/* Reference data type - heap - like dynamic
arrays
object literals
functions
dates
*/
// Primitive data type:
// string
var name = 'Ram'
console.log("My name is " + name);
console.log("data type of name is " + typeof name);
// numbers
let age = 32.5;
console.log("my age is " + age);
console.log("data type of age is " + typeof age);
// boolean
let isDriver = true;
console.log("data type is " + typeof isDriver);
// null
let x = null;
console.log("data type is " + typeof x); // data type result is object but it is Primitive data dype
// undefined
let y = undefined;
console.log("data type is " + typeof y);
// Reference data type:
// array
let arr = [2, 4, 6, 7, true, 'ram']
console.log("data type is " + (typeof arr));
// object leterals
let marks = {
ram: 78,
'rohan kumar': 34,
melrose: 38
}
console.log(marks);
console.log("data type is " + (typeof marks));
// functions
function myfunc() {
}
console.log("data type is " + (typeof myfunc));
// date
let date = new Date();
console.log(date);
console.log("data type of date is " + (typeof date)); // data type of date is object