-
Notifications
You must be signed in to change notification settings - Fork 0
/
task19.ts
33 lines (27 loc) · 1001 Bytes
/
task19.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
30
31
32
33
/*
Dinner Guests: Working with one of the programs from Exercises 14 through 18, print a message indicating the number of people you are inviting to dinner.
*/
// More Guests: You just found a bigger dinner table, so now more space is available. Think of three more guests to invite to dinner.
let guestList: string[] = ["Saleem", "Farooq", "Javed", "Ali Raza"];
guestList.map((guest) => {
console.log(
`Hello ${guest} i am inviting you to please join my dinner party. \n`,
);
});
console.log(
`Sorry ${guestList[2]} and ${guestList[3]} can't come to dinner. \n`,
);
// Modified List
guestList.splice(2, 1, "Ayaz");
guestList.splice(3, 1, "Rizwan");
console.log(
"Great News! I got the large table now i am inviting some other my cool friends",
);
guestList.push("Dost Ali", "Saad", "Majid");
guestList.map((guest) => {
console.log(
`Hello ${guest} i am inviting you to please join my dinner party. \n`,
);
});
// Start
console.log(`My Total Guests are ${guestList.length}`);