Hello–I have a student who created the quote maker app with only onEvents and no variables (they were working ahead before I gave instructions for that lesson). It’s working, but I need help explaining why it’s preferred to do it the way prescribed in the activity guide.
I’m including the code for you to see. Thanks in advance!
onEvent("quoteInput", "input", function() {
setText("quoteOutput", getText("quoteInput"));
});
onEvent("fontFamilyInput", "input", function() {
setProperty("quoteOutput", "font-family", getText("fontFamilyInput"));
});
onEvent("colorInput", "input", function() {
setProperty("colorOutput", "background-color", getText("colorInput"));
});
onEvent("fontSizeInput", "input", function() {
setProperty("quoteOutput", "font-size", getNumber("fontSizeInput"));
});
onEvent("imageInput", "input", function() {
setProperty("colorInput", "image", getText("imageInput"));
});