-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion17.html
More file actions
56 lines (43 loc) · 1.8 KB
/
Question17.html
File metadata and controls
56 lines (43 loc) · 1.8 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Question 17</title>
</head>
<body>
<script>
const guest = ["Henry", "James", "Ahmed", "Kevin"];
for(person of guest){
console.log(`Hello ${person} hope you are doing well. We are arranging a dinner party at our home tommorow and you are invited.`);
}
console.log(`${guest[0]}, isn't available to attend the party.`);
guest[0] = "Sam";
for(person of guest){
console.log(`Hello ${person} hope you are doing well. We are arranging a dinner party at our home tommorow and you are invited.`);
}
console.log(`Hey guys, we just found out that we have space for 3 more guests.`);
guest.unshift("Sara"); //added at start
guest.push("Abdullah"); //added at end
guest.splice(3, 0, "Tom"); //added in middle
for(person of guest){
console.log(`Hello ${person} hope you are doing well. We are arranging a dinner party at our home tommorow and you are invited.`);
}
console.log(`Hey guys, we just found out that we only have space for 2 guests. Sorry for the inconvenience. 😐`);
for(let i=0; guest.length != 2; i++){
guest.pop();
console.log(`Hello ${guest[i]}, sorry you are not invited. Better luck next time! 😂`);
}
for(person of guest){
console.log(`Hey ${person}, You are still invited to the party 🥳🎉`);
}
for(let i=0; i <= guest.length; i++){
guest.pop();
}
for(person of guest){
console.log(person);
}
</script>
</body>
</html>