-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript3.js
More file actions
223 lines (178 loc) · 4.58 KB
/
Copy pathscript3.js
File metadata and controls
223 lines (178 loc) · 4.58 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/** @format */
/** @format */
// // let human = "john";
// // console.log(human);
// let students = ["Jane"];
// if (students.length > 2) {
// console.log("There are more than 2 students");
// } else {
// console.log("There are less students");
// }
// if (students.length < 2) {
// console.log("There are less than 2 students");
// }
// students.length > 2
// ? console.log("there are more than 2 students in the class")
// : console.log("there are less than 2 students in the class");
// if (condition) {
// } else {
// }
// let boy = "alli";
// let twinBoy = boy;
// console.log(twinBoy);
// const numbers = [10, 30, 30, 03, 103, 70, 90];
// var bigNumber = numbers[5]; // equals to 70
// let smallNumber = numbers[2] - 30 + numbers[2] + bigNumber;
// 100;
// if (bigNumber > smallNumber) {
// bigNumber = bigNumber + smallNumber;
// }
// console.log(bigNumber);
// ? array
// let students = ["joy", "jane", "john", "john", "john", "joy", "john", "john"];
// console.log(students);
// let firstBoys = students.slice(2, 5);
// console.log(firstBoys);
// ? boolean value
// true
// false,
// const FALSE = false;
// const TRUE = true;
// if (false) {
// console.log("data is false");
// } else {
// console.log("data is true");
// }
// if (TRUE) {
// console.log("data is true");
// }
// ? strings
// let string = 124506859055;
// console.log(string.length);
// console.log(string.trimEnd().length);
// console.log(string.includes("world"));
// console.log(string.toUpperCase())
// console.log(string.toLowerCase())
// ? match method
// const string = "The rain in SPAIN, stays mainly in plain";
// const response = string.match(/ain/g);
// console.log(response);
// ? the match method returns an array containing the results of that search
// ? slice method
// const string = "hello world";
// const newString = string.slice(6, 11);
// console.log(newString);
// ? endsWith method
// const string = "hello world, welcome to the universe";
// console.log(string.endsWith("universe"));
// console.log(string.startsWith("hello"));
// ? concat method
// const string = "hello ";
// const string2 = "world";
// const newString = string.concat(string2);
// console.log(newString);
// ? alert method from the window
// alert("hello world")
// ? prompt method from the window
// prompt("hello what's your name")
// if (window.confirm("do you want a greeting message")) {
// const userName = prompt("what is your name?");
// if (userName) {
// alert("hello " + userName + " welcome back");
// } else {
// alert("you didn't enter your name");
// }
// }
// function greetMe() {
// if (window.confirm("do you want a greeting message")) {
// const userName = prompt("what is your name?");
// if (userName) {
// alert("hello " + userName + " welcome back ");
// } else {
// alert("you didnt enter your name");
// }
// }
// }
// const student = {
// name: "khalid",
// class: "grade 4",
// year: 2018,
// state: "bauchi",
// };
// console.log(student.class)
// const students = ["jane", "doe", "joy"];
// console.log(students[2]);
// students[2] = "joseph";
// console.log(students[2]);
// const student2 = [
// {
// name: "jane",
// class: "grade 2",
// year: 2022,
// state: "plataeu",
// },
// {
// name: "doe",
// class: "grade 2",
// year: 2021,
// state: "edo",
// },
// {
// name: "jane2",
// class: "grade 2",
// year: 2015,
// state: "rivers",
// },
// ];
// const onlyGirls = [student2[0], student2[2]];
// console.log(onlyGirls);
const jane = {
name: "JANE",
email: "jane@email",
phone: 0902344,
};
console.log(jane);
jane.email = "newjane@email";
console.log(jane);
// const funitures = ["sofa", "dining table", "couch", "cabinet", "wardrobe"];
// const students = ["jane", "doe", "joy", "chima"];
// console.log(students.length);
// const allBoys = students.slice(1, 2);
// console.log(allBoys);
// funitures[0] = "chair";
// funitures["sofa"] = "chair";
// console.log(funitures);
// objects;
// const funitures = [
// {
// name: "sofa",
// },
// {
// name: "table",
// },
// {
// name: "couch",
// },
// {
// name: "cabinet",
// },
// {
// name: "wardrobe",
// },
// ];
// console.log(funitures);
// funitures[0].name = "chair";
// console.log(funitures);
// if (2 === 4) {
// console.log("equation is true");
// }
// if (2 === 4) {
// console.log("equation is true");
// } else {
// console.log("equation is not true");
// }
// if (2 === 4) {
// console.log("equation is not true");
// } else if (2 === 6) {
// console.log("equation is true");
// }