-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstep14.js
More file actions
16 lines (16 loc) · 743 Bytes
/
Copy pathstep14.js
File metadata and controls
16 lines (16 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"use strict";
const originalGuestList = ["Asad", "Arslan", "Qasim", "Khalid", "Hashim"];
for (let i = 0; i < originalGuestList.length; i++) {
console.log(`Dear ${originalGuestList[i]}, I would like to invit you dinner. `);
}
console.log("Great New , I found a bigger dinner table!");
const newGuestBegging = "Zayan Ali";
originalGuestList.unshift(newGuestBegging);
const newGuestMiddle = "Fahad Khan";
const middleIndex = Math.floor(originalGuestList.length / 2);
originalGuestList.splice(middleIndex, 0, newGuestMiddle);
const newGuestEnd = "Hammad ul Hassan";
originalGuestList.push(newGuestEnd);
for (let i = 0; i < originalGuestList.length; i++) {
console.log(`Dear ${originalGuestList[i]}, I would like to invit you dinner. `);
}