-
Notifications
You must be signed in to change notification settings - Fork 0
/
q15.ts
29 lines (25 loc) · 1001 Bytes
/
q15.ts
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
//More Guests: You just found a bigger dinner table, so now more space is available.
//Think of three more guests to invite to dinner.
const guestList: String[] = ["Usama Yousaf", "Ali Ahmad","Virat Kohli", "Hashim Raza"];
console.log(guestList.length);
console.log(`Unfortunately ${guestList[2]} is not comming to the dinner`);
guestList.splice(2,1,"Haris Khan");
guestList.forEach((element) => {
console.log(
`Hi, ${element} I hope you are fine. I am inviting you for a dinner please come join us.`
);
});
//Problem Start
console.log("I have a good news for all of you finally I've found a big table for dinner");
console.log(guestList.length);
guestList.unshift("Hassan Iqbal");
let middlevalue = guestList.length/2;
console.log(middlevalue);
guestList.splice(middlevalue,0,"Zeeshan Ali");
guestList.push("Ali Raza");
guestList.forEach((element) => {
console.log(
`Hi, ${element} I hope you are fine. I am inviting you for a dinner please come join us.`
);
});
export{}