-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCh 1 Practice Set.js
72 lines (43 loc) · 1.34 KB
/
Ch 1 Practice Set.js
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
//Ch 1 Variable -> Practice Set
// Q1) Create a Variable of Type String And try To Add a Number To It.
let a = "Darshan";
let b = 10;
console.log(a + b);
// Output: Darshan10
// Q2) Use typeof Operator To Find Data-type of the First Question of the Last Answer.
console.log(typeof (a + b));
// Output: String
// Q3) Create a Const Object in JavaScript. Can You Change It to Hold A Number Latter?
const c = {
name: "Darshan",
author: "CrptoMinds",
isPrincipal: false
}
c = 1;
// Output: Assignment to Constant Variable -> Ans Is No
// Q4) Try To Add a New Key In Q3 Const Object. Were You Able To Do It?
const c1 = {
name: "Darshan",
author: "CrptoMinds",
isPrincipal: false
}
c1['friend'] = "Krupali";
//const c1 -> Point Object -> We Can Change Value Inside The Object -> We Can't Make New c1 Objact Again -> Because Of Constant
console.log(c1);
// Output:
// {
// name: 'Darshan',
// author: 'CrptoMinds',
// isPrincipal: false,
// friend: 'Krupali'
// }
// Q4) Write A JS Program To Create a Word-Meaning Dictionary Of 5 Words.
const dict = {
appreciate: "recognize the full worth of ",
ataraxia: "a state of freedom from emotional disturbance",
yakka: "Work, especially hard work."
}
console.log(dict.yakka);
console.log(dict['yakka']);
// Output: Work, especially hard work.
// Work, especially hard work.