Spaces in Javascript

Hi everyone. Just a quick question. I’ll be checking online as well. Does anyone know for Javascript if you MUST use spaces around operators ex. =, +? Is Javascript really that touchy? Thanks everyone!

it is considered best practice as it makes things more readable but not necessary
the program works the same, humans that will read the program after you will thank you for the spaces

1 Like

No. The spaces are not required. You can test this yourself pretty easily.

Lol okay thanks guys. Also, still having issues with getting JS to work so testing hasn’t been possible yet. It’s not rocket science though. Should figure it out soon.

what do you mean you are having issues with making it work?
you can open the browser console, and try your code there

Visual Studio Code using the Quokka extenstion is a nice way to play around with JS. There is also RunJS. Or as said, you can always use the browser console (Ctrl+Shift+J).

I also had trouble getting Javascript to work when i was first starting out. To test the code in the console on a web page just open up a page and hit (ctrl+shift+i) on windows or look for developer tools in the browser menu. I would suggest first typing some code that you saw in a tutorial into the console box and watching it work. Then you can change the code around and make your own