JS syntax questions

I was taught c# as my first language and I am having some issues remembering JS syntax and convention differences.

The biggest ones I run in to are that I can never remember when I am supposed to use : instead of =. I also get confused that it wants me to use commas instead of semicolons after brackets alot of the time. I am currently in objects section of the javascript course. What am I failing to remember here as far as these rules go?

I loosely like to think of it this way: if you have the format object = {}, the key-value properties in those brackets are going to be written key: value. I might be slightly off in this type of thinking (I’m not sure I should be calling it “key-value” but it’s hard for me to dissociate it from python dictionaries…)

Try looking at this chapter in Eloquent Javascript (useful resource): https://eloquentjavascript.net/06_object.html

And here you can see more about dictionaries/associative-arrays… you might see the overlap with objects in some of these responses: https://stackoverflow.com/questions/3559070/are-there-dictionaries-in-javascript-like-python

1 Like