-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata type.js
More file actions
49 lines (38 loc) · 1.06 KB
/
data type.js
File metadata and controls
49 lines (38 loc) · 1.06 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
// Primitive datatype
let str="javascript";
console.log(str,typeof(str)); // string
let num=25;
console.log(num,typeof(num)); //num
let numnum=23.456;
console.log(numnum,typeof(numnum)); // num
let a= null;
console.log(a,typeof(a)); // object
let b;
console.log(b,typeof(b)); //undefined
let bool=true;
console.log(bool,typeof(bool)); // boolean
let BigInt=12233333n;
console.log(BigInt,typeof(BigInt)); //bigint
// nonprimitive data type
// array
let arr=["one",2,"five",6] // declare array by list
console.log(arr,typeof(arr));
console.log(arr[2]); // index ref we call by index 2
arr[2]="sixty"; // reassign
console.log(arr);
// object == key and values pair //look like json format
let obj=
{
name:"reena", role:"qa" // syntax
}
console.log(obj,typeof(obj));
console.log(obj.name); //ref we call by obj.ref
obj.name="poori"; // reassign from reena to poori
console.log(obj);
// functions -- block of code reuse
function Demo()
{
console.log("hello"); // syntax
}
Demo() // calling func by function name
// dymanic calling of function