Skip to content

Instantly share code, notes, and snippets.

@kvirani

kvirani/lunch.js Secret

Last active March 21, 2024 20:46
Show Gist options
  • Save kvirani/125d2e9f46faab4049e0a50660170fd2 to your computer and use it in GitHub Desktop.
Save kvirani/125d2e9f46faab4049e0a50660170fd2 to your computer and use it in GitHub Desktop.
W1D1 - What to do for Lunch?
/*
* Modify the contents of the function below, such that:
*
* If we're not hungry, we want to tell ourselves to get back to work.
* Otherwise, we want to pick something up and eat it in the lab when
* we've got less than 20 minutes or to try a place nearby if we've
* got between 20 and 30 minutes. If we have any more time than that,
* we want to remind ourselves that we're in a bootcamp and that we
* should reconsider how much time we actually have to spare.
*
* hungry is a Boolean, representing if you're hungry or not.
* availableTime is a Number representing the time you have for lunch,
* in minutes.
*/
const whatToDoForLunch = function(hungry, availableTime) {
console.log("I don't know what to do!");
}
/*
* This is some test runner code that's simply calling our whatToDoForLunch function
* defined above to verify we're making the right decisions. Do not modify it!
*/
console.log("I'm hungry and I have 20 minutes for lunch.");
whatToDoForLunch(true, 20);
console.log("---");
console.log("I'm hungry and I have 50 minutes for lunch.");
whatToDoForLunch(true, 50);
console.log("---");
console.log("I'm not hungry and I have 30 minutes for lunch.");
whatToDoForLunch(false, 30);
console.log("---");
console.log("I'm hungry and I have 15 minutes for lunch.");
whatToDoForLunch(true, 15);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment