Skip to content

Instantly share code, notes, and snippets.

@desinas
Last active December 21, 2017 10:22
Show Gist options
  • Save desinas/b613c61d1f1b5cea81e34223e88bad4a to your computer and use it in GitHub Desktop.
Save desinas/b613c61d1f1b5cea81e34223e88bad4a to your computer and use it in GitHub Desktop.
Umbrella Quiz (7-11) of Udacity FEWD
/*
* Programming Quiz: Umbrella (7-1)
*/
var umbrella = {
color: "pink",
isOpen: true,
open: function() {
if (umbrella.isOpen === true) {
return "The umbrella is already opened!";
} else {
umbrella.isOpen = true;
return "Julia opens the umbrella!";
}
},
close: function() {
if (umbrella.isOpen === false) {
return "The umbrella is already closed!";
} else {
umbrella.isOpen = false;
return "Julia closes the umbrella!"
}
}
};
@desinas
Copy link
Author

desinas commented Dec 21, 2017

What Went Well

  • Your code should have a variable umbrella
  • The variable umbrella should be an object
  • Your umbrella object should have a color property
  • Your umbrella object should have a isOpen property
  • Your umbrella object should have an open() method that toggles the value of isOpen
  • Your umbrella object should have an close() method that toggles the value of isOpen

Feedback: Your answer passed all our tests! Awesome job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment