Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions answer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//1

function flowersabc (a, b, c){
console.log(a + b + c);
}

flowersabc(3, 5 ,7 );

//2

function colorCar(color){
console.log("a " + color + " car")
}

colorCar("blue");

//3

let canada = {

people: "kind",
economy: "not bad not good",
numberOfProvience: 13
};

function myFunction() {
console.log(canada);

}
myFunction();

//4

function vehicleType(color, code){
if (code===1){
console.log("a " + color+ " motorbike");
}else{
console.log(code +" " + color + " car")
}
}

vehicleType("yellow",3);

//5

console.log(3 === 3? "yes" : "no")

//6//7//8//9

let vehicleList=["atv","motorbike", "caravan", "bike", ]

function vehicle(color, code, age){

const vehicleCode=vehicleList[code];

if(age>1 ){
console.log("a" + color + " used " + vehicleCode )
}else{
console.log("a" +" " + color + " new " + vehicleCode )
}
}
vehicle("green", 1, 3);


37 changes: 26 additions & 11 deletions ex.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
// TODO: define addFavoriteBook(..) function

// TODO: define printFavoriteBooks() function

const favoriteBooks = [];

addFavoriteBook("A Song of Ice and Fire");
addFavoriteBook("The Great Gatsby");
addFavoriteBook("Crime & Punishment");
addFavoriteBook("Great Expectations");
addFavoriteBook("You Don't Know JS");

// TODO: print out favorite books
function addFavoriteBook(bookName) {
if (!bookName.includes('Great')) {
favoriteBooks.push(bookName);
}
}

// TODO: define printFavoriteBooks() function

function printFavoriteBooks() {
console.log('Favorite Books: ' + favoriteBooks.length);
for (const index of favoriteBooks) {
console.log(index);
}
}

const favoriteBooks = [];

addFavoriteBook("A Song of Ice and Fire");
addFavoriteBook("The Great Gatsby");
addFavoriteBook("Crime & Punishment");
addFavoriteBook("Great Expectations");
addFavoriteBook("You Don't Know JS");

// TODO: print out favorite books

printFavoriteBooks();