Missing Semicolon Changing Keyword Behavior

Hello All! I eventually figured out what I was doing wrong, but I’m curious why the IDE was behaving the way it was.

I was working on exercise 3/10 on Learn Javascript: Objects (Accessing Properties). and I noticed that while my first variable worked perfectly, the syntax highlighting changed for the variable immediately below it.

It turns out I was missing a semicolon on the first variable line and that was what was affecting the line below it but what exactly was going on? was the IDE reading the second variable declaration as part of the property I was calling in the line above it? due to the lack of semicolon?

I solved the problem, but was just looking for deeper understanding. See screenshot below for reference


Remove quotation mark.
{Fuel Type : 'Turbo Fuel}

Directly from the lesson:

> `'Fuel Type'` has quotation marks because it contains a space character.

That key must be entered as a string because of the space character. Also not what I was inquiring about, however thank you for your input.

I do not experience this.


1 Like

WEIRD! Adding Semicolon made the code work for me. This was after trying multiple variable declarations and syntax changes…

could it be a bug in the requirement of the lesson? I know sometimes there is backend code to validate the tasks that we don’t see.

1 Like

It may just be a bug. And JS does require semi-colens but with modern interpreters and Just In Time compiler the interpreter does not need them anymore. See more detail here.

1 Like

Thank you for the insight. Was mainly my curiosity getting the best of me

1 Like