Skip to content

Commit 4381917

Browse files
authored
Update moreJs-10.js
removed unnecessary ',' from end of line 19.
1 parent 1654040 commit 4381917

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

Week3/moreJs-10.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,19 @@ Use the list of vehicles to write an advertisement.
55
motorbikes, caravans and bikes.".
66
(Hint: use a for loop.)
77
*/
8-
function advertisement(){
9-
// let vehicles = [' motorbike' , ' caravan', ' bike', ' car'];
10-
// variable 'vehicles' is can be read from moreJs-7and8.js
11-
// but i used it again inside of function to show you,
12-
// and in case you can run in a html seperately.
13-
let products = [];
14-
for(i=0; i<vehicles.length; i++){
15-
products.push(' ' + vehicles[i]+'s');
16-
}
17-
let lastTwoProduct = products[products.length - 2] + ' and' + products[products.length - 1] ;
18-
console.log(lastTwoProduct);
19-
products.splice((products.length - 2), 2,);
20-
21-
console.log('Amazing Abdullah\'s Garage, we sell ' + products.join() + ',' + lastTwoProduct +'.');
22-
8+
function advertisement() {
9+
// let vehicles = [' motorbike' , ' caravan', ' bike', ' car'];
10+
// variable 'vehicles' is can be read from moreJs-7and8.js
11+
// but i used it again inside of function to show you,
12+
// and in case you can run in a html seperately.
13+
let products = [];
14+
for (i = 0; i < vehicles.length; i++) {
15+
products.push(' ' + vehicles[i] + 's');
16+
}
17+
let lastTwoProduct = products[products.length - 2] + ' and' + products[products.length - 1];
18+
console.log(lastTwoProduct);
19+
products.splice(products.length - 2, 2);
2320

21+
console.log("Amazing Abdullah's Garage, we sell " + products.join() + ',' + lastTwoProduct + '.');
2422
}
2523
advertisement();
26-

0 commit comments

Comments
 (0)