Tuesday, July 10

1 Dozen Eggs Coding = Will I have enough for my recipe and if I don't or do what will happen? - coding practice fun programming JavaScript

Just a little JavaScript fun with eggs. If I need a dozen eggs to make this recipe work. I can't have anything less than 1 dozen, 12 eggs. However, more is fine, I still have enough! Here is my cute little code using the if and else to either alert me if I have enough or the else will send into the console, the not enough result. 

function totalEggsIHave(eggsInTheCarton) {
let oneDozen = 12;
let myResults= oneDozen;
if  (myResults <= Math.ceil(eggsInTheCarton)) {
alert('You have enough for the recipe ☺'); 
} else {
console.log('You don\'t have enough to make this recipe');
}
}
[enter]


totalEggsIHave(18);
[enter]
alert result = You have enough for the recipe ☺
totalEggsIHave(8);
[enter]
results= You don't have enough to make this recipe
Hope you enjoy and thanks for visiting! 

Interested in shopping at yard sales? How about online?
Well, what about getting things you love for FREE?
I invite you to get points and go shopping on Listia for anything you'd like to buy.


Do you want to make money fast, while surfing the internet?
Just accept my link and you will be able to profit from your searches with Qmee.


Love News? Staying up to date with current issues in the news?
I invite you to become a member and voice your opinion on current topics and recent events.

Thank You 
You can follow me here: