Skip to content

completed all tasks for the module #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
47 changes: 33 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ The function should:
*/


function createMenuItem(/*Your code here*/){
/*Your code here*/
function createMenuItem(name, price, category){
return {name, price, category};
}


console.log('task 1a', createMenuItem('tacos', 8, 'Lunch'))

/* 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 1b (not auto-tested): 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
Invoke your function!
Expand Down Expand Up @@ -52,8 +52,17 @@ const burger = {
price: 18,
category: "Lunch",

discount: function(person){
if(person === 'teacher' || person === 'student'){
return this.price - (this.price * 0.25);
}else if(person === 'public'){
return this.price - (this.price * 0.10);
}else{
return 'no discount available'
}
}
}

console.log('task 2', burger.discount("teacher"))


///////////////Reviews (MVP)///////////////////
Expand All @@ -72,8 +81,7 @@ const reviews = [
Using the reviews array above:
1. log only Julius' feedback to the console - no function needed
*/


console.log('task 3', reviews[5].feedback)

/* 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 4 (not auto-tested): 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
Reyna's feedback is missing! Use what you know to do the following: (no function needed)
Expand All @@ -95,10 +103,21 @@ Use the addReview function below to do the following:
*/


function addReview(/*Your Code Here */){
/*Your Code Here */
function addReview(array, name, rating, feedback){

array.push({name, rating, feedback});

/*{
name: Daniela
rating: 5
feedback: 'Beautiful atmosphere and wonderful vegan options!'
};*/

return array;

}

console.log(addReview(reviews, 'Daniela', 5, 'Beautiful atmosphere and wonderful vegan options!'));


/* 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 6: 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
Expand All @@ -112,10 +131,10 @@ Use the getReviewByIndex function below to do the following:
*/


function getReviewByIndex(/*Your code here*/) {
/*Your code here*/
function getReviewByIndex(array, number) {
return `${array[number].name} gave the restaurant a ${array[number].rating} star review, and their feedback was: ${array[number].feedback}`
}

console.log(getReviewByIndex(reviews, 0));


/* 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 7: 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀
Expand All @@ -131,10 +150,10 @@ Use the getLastReview function below to do the following:
*/


function getLastReview(/*Your code here*/) {
/*Your code here*/
function getLastReview(array) {
return `${array[array.length - 1].name} gave the restaurant a ${array[array.length - 1].rating} star review, and their feedback was: ${array[array.length - 1].feedback}`
}

console.log(getLastReview(reviews));


///////////////🍔☕️🍽 STRETCH🍔☕️🍽////////////////////
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.