Unit 5 L8 Error Code

Can I get help figuring out why the code below is generating a drop down text selection error?

onEvent(“dropdown_week”, “change”, function(event) {
if (getText(“dropdown_week”) == “Monday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Tuesday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Wednesday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Thursday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Friday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Saturday”) {
setText(“msg_label”, “It’s the weekend! Stay home!”);
} else {
if (getText(“dropdown_week”) == “Sunday”) {
setText(“msg_label”, “It’s the weekend! Stay home!”);
}
}
}
}
}
}
}
});

Congrats on your first post, Christine! On thing of note, when I copy and past your code app lab is unhappy with your double-quotes. There is more than one ASCII character for double-quotes and app-lab only plays nice with the right one.

Bad double-quotes (notice how they are different for the beginning and end of dropdown_week):
onEvent(“dropdown_week”, “change”, function(event) {
if (getText(“dropdown_week”) == “Monday”)

Good double-quotes:
onEvent(“dropdown_week”, “change”, function(event) {
if (getText(“dropdown_week”) == “Monday”)

A quick find-and-replace and this works:

Hi James,
Can you please clarify for me? when I look at what you showed under the bad double quotes and the good double quotes examples, they are identical. I do not see how they are different.

Hopefully, it is a little easy to see side by side:
“dropdown_week”
“dropdown_week”

The first being the ‘curly’ quotes and the second being the straight quotes. This article maybe shows the difference better:

I just noticed that the forum (or my browser) automagically converts the quotes to curly… Sorry for that rabbit hole of sorts, I’ve just had code that looked correct but didn’t work.

That said, if I slap your code into applab, replace the curly quotes, and added dropdown_week and msg_label to the design view, it technically works, though passing the parameter “Event” in the function throws a warning:
https://studio.code.org/projects/applab/79OjmNZdCDsS7k5-_wJJO1RqQ_jHoPIpp4JUPmIvxGQ

Not sure what the original code looked like, but the “event” parameter isn’t doing much in the example linked above. Something like this comes out a little easier on the eyes and separates out the function from the onEvent:
https://studio.code.org/projects/applab/lUyOAaDCMnxIMsiT16DTUOZT1IX9l_u00LToxw9seLk

Feel free to remix/share the work so we can see the original code you are having issues with.