Class syntax reference issue

Hello! So I’m getting to the “fun” or at least professional stuff in my JS Udemy course. And I hit this issue while declaring a class and trying to see in the console.

I appreciate the help. I think I’m using the name too many times.

What do you think those error messages are telling you?

Once you’ve figured this out (there isn’t any class syntax issue, things are behaving exactly as you should expect them to), note that you can do what you’re trying to do in Chrome via some weird magic scope trickery in the console repl, but Firefox console just follows normal JS rules.

That when I use ‘Carl’ again, because it’s a const that I can’t declare it again?

Just leave off the const, or use var (which allows redeclaring). It’ll be global, which is what you want here (means you need to be a bit careful if you’re copy pasting between the console and a file tho)

Lmao okay man. I’ll try that. I don’t see myself going far enough to get a job in this field anyway after a few years if I’m being honest. This is getting mind numbing.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.