1let picture = ["abc", "ded"];
2
3function addBorder(picture) {
4 //adding the * on the top of the picture array as equal to the lenght of the top element of the array.
5 let top = '*'.repeat(picture[0].length);
6 picture.unshift(top);
7
8 //looping through the array and concat the * at the end and the start of the array
9 for(let i = 0; i < picture.length; i++){
10 picture[i] = picture[i] + '*';
11 picture[i] = '*' + picture[i];
12 }
13
14 //adding the * on the bottom of the picture array as equal to the lenght of the last element of the array.
15 let bottom = '*'.repeat(picture[1].length);
16 picture.push(bottom);
17
18 return picture;
19}
20
21