Sleep Debt Calculator Code Error

I feel as though my code is typed fine, (I could be wrong) but why are the parameter, switch statement declaration, and default displaying incorrectly? Also, my code produces an error when I try to run it. Here is a screenshot

Hey there,

Two things I notice

  • Some of your cases end with a colon, while others do not
  • Your returns don’t have a semi-colon

I would start there and see how it goes :wink:

1 Like

Thank you @ghostlovescore,

I applied the fixes you recommended, and it did resolve the default error, but the parameter and switch statement declaration are still incorrect…

It remains this way even when I restart.

Alright, we’re getting there!

Take a quick look at the error message.

error

See the two ^^ ? They show you exactly what to look for.

The message also says: SyntaxError: Unexpected string.

Based on that, how could we possibly solve this? :slight_smile:

2 Likes

Also for problems like these, consider using a text editor (vs code, sublime, atom) where you can troubleshoot much more precisely AND take a look at documentation like this (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch).

You’d be surprised how much quicker you can tackle the codecademy modules like this

1 Like

THANK YOU!

It is still showing the incorrect colors for the parameter and switch statement declaration. (is switch statement declaration correct terminology?)

It’s really throwing me off. Should I just ignore it?

This I’m not too sure about. Colors seem fine to me?

@toastedpitabread what do you think?

@coreybarbato that color looks ok to me. Although I’m more used to my sublime text colors :slight_smile:

@ghostlovescore the hint and walkthrough video display the day & switch in the same blue as the other code… I get how it may seem right if you aren’t using this editor specifically. It still runs, but I just want to be sure I can ignore this issue or fix something I may be doing incorrectly…

I would definitely ignore it. Especially if it runs and is validated.

1 Like

Oh ok I see where you’re coming from with this now!

Don’t worry, the Learning Environment from the video is probably an older version, and has been updated since then. Colors don’t really matter much, in fact. With your own text editor, you can actually customize them fully!

1 Like

@ghostlovescore @toastedpitabread

Thank you, both! :heart:

2 Likes