week7 submission#8
Conversation
| function vehicleType (color,code) { | ||
| if (code == 1) { | ||
| return `a ${color} car` | ||
| } else { |
There was a problem hiding this comment.
This function should print out motorbike only if code is 2. What if I called the function like this: vehicleType('blue', 3)?
| console.log(listOfVehicles[2]) | ||
|
|
||
| //Question 9 | ||
| function vehicleType (color,code,age) { |
| return `a ${color} used motorbike` | ||
| }else if(code ==1 && age==0) { | ||
| return `a ${color} new car` | ||
| } else { |
There was a problem hiding this comment.
Similar comment to above - if I call this function with a code that is not 2 or 1, the output will be motorbike, but that's not the expected output.
| } | ||
|
|
||
| //Question 7 | ||
| listOfVehicles = ["motorbike", "caravan", "bike"] |
There was a problem hiding this comment.
Make sure to use const or let to declare the variable.
| const favoriteBooks = []; | ||
|
|
||
| function addFavoriteBook (bookName) { | ||
| if (bookName.includes("Great")!== true) { |
There was a problem hiding this comment.
Can you think of a shorter way to write this condition without having to use !== true?
| // TODO: define printFavoriteBooks() function | ||
|
|
||
| const favoriteBooks = []; | ||
| function printFavoriteBooks() { |
There was a problem hiding this comment.
Right now, your function is only printing out the number of books, but it should also print out what's in the favoriteBooks array.
The for loop that you wrote on line 21 should also be included in the printFavoriteBooks function.
| @@ -0,0 +1,57 @@ | |||
| //Question 1 | |||
| function sumOfThree (num1,num2,num3) { | |||
| return num1+num2+num3 | |||
No description provided.