Skip to content
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

Execise on JS #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
65 changes: 62 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,47 @@ Create a variable that stores the name of your cafe.
Print out a greeting such as "Welcome to Technigo Cafe! What would you like to order today?"
Where Technigo Cafe is replaced by the name of your cafe that is stored in the variable.
*/
const cafeName = "Technigo Cafe";
console.log(`Welcome to ${cafeName}! What would you like to order today?`);

// HINT: Don't use var, stick to let and const.

const cafeName = "Fika Cafe";
alert(`Welcome to ${cafeName}! What would you like to order today?`);

/*

2)
Create a variable that stores the price of a coffee.
Create a variable that stores how many coffees the customer wants.
Print out the total price such as "There you go, that'll be 10 euros"
Where 10 is replaced by the calculation of the total price.
*/

const coffeePrice = 3.5; // Price of one coffee in euros

// Prompt the user for the number of coffees
const numberOfCoffees = prompt("How many coffees would you like?");

// Calculate the total price
const totalPrice = coffeePrice * numberOfCoffees;

// Display the total price
alert("There you go, that'll be " + totalPrice + " euros");

/*
3)
Create a variable that stores a boolean.
Print out "You said this coffee is the best, that was actually true"
Where true is replaced by your varible
*/
*/

const coffeeIsBest = prompt("Do you think this coffee is the best? (yes/no)");

if (coffeeIsBest === "yes") {
alert("You said this coffee is the best, that was actually true");
} else {
alert("You said this coffee is not the best, that's interesting");
}


/*
4)
Expand All @@ -31,6 +55,17 @@ Assign it a new value.
Print it out. => This should give you the new value.
*/

let cafeGuests = 10;
// alert("We have ${cafeGuests} guests.");

alert(`we have ${cafeGuests} guests`);

cafeGuests = 15;
// alert("We have ${cafeGuests} guests.");

alert(`now we have ${cafeGuests} guests`);


/*
5)
Create a variable called maxGuests, that shows us how many guests are allowed in the cafe.
Expand All @@ -40,17 +75,41 @@ assign it a new value.
Print it out. => This should give you an error because it shouldn't be able to be changed.
*/


const maxGuests = 20;
alert(`we can have only ${maxGuests} guests`);

//maxGuests = 30;
//alert(`we can have only ${maxGuests} guests`);

/*
6)
Create a variable that stores a string.
Print out that string in only UPPERCASE letters.
*/

const guestName = prompt("what is your name?");

const upperguestName = guestName.toUpperCase()

// console.log(GuestName.toUpperCase);
// // will give you "JENNIE"


alert(`Hello ${upperguestName} welcome!`);

/*
7)
Print out the same string in only lowercase letters.
*/


const lowerguestName = guestName.toLowerCase()
alert(`Hello ${lowerguestName} welcome!`);




/*
8) **BONUS**
Print out the string "Today we have a special summer deal!".
Expand Down