Skip to content

Instantly share code, notes, and snippets.

@Melkanea
Last active June 7, 2020 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Melkanea/9fe9a0871ea8454b3742c40b281043da to your computer and use it in GitHub Desktop.
Save Melkanea/9fe9a0871ea8454b3742c40b281043da to your computer and use it in GitHub Desktop.
//Melkaneas Tribute Pet Project -- Kimberly SandwichMaker v2
var sandwichmaker = {
topsList: "",
toppings: [],
toppingCount: 5,
sandwichmaker: function () {
for (var i = 0; i < this.toppingCount; i++){
var topsTemp = prompt("please add your favorite toppings");
this.toppings.push(topsTemp);
}
},
showSand: function (toppings) {
topsList = "<ul>" + "BREAD" + "<br>";
for (var i = 0; i < toppings.length; i++) {
topsList += "<li>" + toppings[i] + "</li>" + "<br>";
}
topsList += "BREAD" + "</ul>";
this.topsList += topsList;
},
debug: function () {
console.log(this.tops);
console.log(this.topsTemp);
console.log(this.topsList);
console.log(this.toppings);
console.log(topsList);
}
}
sandwichmaker.sandwichmaker();
sandwichmaker.showSand(sandwichmaker.toppings);
document.write(sandwichmaker.topsList);
//sandwichmaker.debug();
@Melkanea
Copy link
Author

I hope you like it now that i have finished with the beginners JS course

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