Skip to content

week7 submission#8

Open
kursadc wants to merge 1 commit into
hackyourfuturecanada:Kursad-Ciftcifrom
kursadc:master
Open

week7 submission#8
kursadc wants to merge 1 commit into
hackyourfuturecanada:Kursad-Ciftcifrom
kursadc:master

Conversation

@kursadc
Copy link
Copy Markdown

@kursadc kursadc commented Sep 1, 2019

No description provided.

Copy link
Copy Markdown
Collaborator

@epq epq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! 👍

Comment thread answer.js
function vehicleType (color,code) {
if (code == 1) {
return `a ${color} car`
} else {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should print out motorbike only if code is 2. What if I called the function like this: vehicleType('blue', 3)?

Comment thread answer.js
console.log(listOfVehicles[2])

//Question 9
function vehicleType (color,code,age) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Comment thread answer.js
return `a ${color} used motorbike`
}else if(code ==1 && age==0) {
return `a ${color} new car`
} else {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread answer.js
}

//Question 7
listOfVehicles = ["motorbike", "caravan", "bike"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to use const or let to declare the variable.

Comment thread ex.js
const favoriteBooks = [];

function addFavoriteBook (bookName) {
if (bookName.includes("Great")!== true) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you think of a shorter way to write this condition without having to use !== true?

Comment thread ex.js
// TODO: define printFavoriteBooks() function

const favoriteBooks = [];
function printFavoriteBooks() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread answer.js
@@ -0,0 +1,57 @@
//Question 1
function sumOfThree (num1,num2,num3) {
return num1+num2+num3
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

Comment thread answer.js
let person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"}

function objectPrinter(person) {
return (person)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use a for...of loop to print out the properties and values from this object.
See here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants