Code manifesting in wrong color, preventing code execution

Hey all,

Trying this JavaScript tutorial and continue to have this problem where when I enter the code, it renders in the incorrect font automatically and doesn’t run properly - for example even when I copy/paste the very first hint for const getUserChoice = userInput => etc., it comes in as purple and orange rather than purple alone, and then all formula which follows is in the incorrect coloring regardless of whether or not it’s exactly what the hints specify - help?


You have userInput = 'paper' in the conditional which is not going to do exactly what you want.

Javascript being javascript, it seems like it doesn’t throw a flat out error in the console when you do this. But it does have some funky consequences (hence why you should always use === if not == but never =).

Here’s some js fun in the console:

test = 4
value = 5
value === test
// false
if (value === test){console.log('hi');}
// (nothing happens)
if (value == test){console.log('hi');}
// (nothing happens)
if (value = test){console.log('hi');}
// hi
// 4
// 4
value === test
// true

Ladies and gentleman: javascript…

For more reference from documentation:

With reference to your comments about the colour not matching the examples and hints; I have found this to be a quirk with the interface here. Perhaps they changed how it behaves slightly since they first created the lessons. It is purely a styling difference and doesn’t affect how the code functions.

Ok thanks @winningblue / @toastedpitabread - my guess is that it was a combination of the two that was screwing me up. My worry was that the colors were misidentifying certain pieces of code and throwing off the end result, so that probably threw me off the scent of errors elsewhere - when I’d finished the code (likely including = instead of === in the one case) it was working except for a few parts so I’ll have to go back to the drawing board and give it another go. Thanks again

1 Like

i think its a bug! i have the same problem.