Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 567c82c

Browse files
committed
.
1 parent e4d4765 commit 567c82c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

week2js/1strings.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,16 @@ myString = myString.replace(/,/g, " ");
1212
console.log(myString);
1313

1414
//note: the /g means to use 'global' scope. if you didn't put this in, only the hello is separated with a space//
15-
15+
let vehiclesList = ["motorbike", "caravan", "bike", "car", "bus"];
16+
function vehiclee(){
17+
let advertisement = "Amazing Joe's Garage, we service ";
18+
for (i = 0; i < vehiclesList.length; i++) {
19+
if (i == vehiclesList.length - 1) {
20+
advertisement += "and " + vehiclesList[i] + "s.";
21+
} else {
22+
advertisement += vehiclesList[i] + "s, ";
23+
}
24+
}
25+
return advertisement;
26+
}
27+
vehiclee();

week2js/3tada15_17.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ ie they both point to the same box, with the box being the [] stuff
1919
note: x does not equal y in this case because they do not point to the same object.
2020
ie: their objects look the same, but they are two different boxes, whilst z is only pointing to y's box,
2121
it is not actually making a whole new box for z */
22-
/*THIS CODE DOESN'T OUTPUT THE RIGHT INFO. THE LAST SHOULD BE FALSE */
23-
2422

2523
/*function compare(a, b) {
2624
var i = a.length;

0 commit comments

Comments
 (0)