re: Dot notation vs Bracket notation VIEW POST

FULL DISCUSSION
 

Great post, Samantha!

Another case where I would personally use bracket notation is when the property name is odd - that alerts the reader that the properties in the object are non-standard!

user.firstName;      // camelCase notation as usual.
user['first_name'];  // underscore notation, using brackets to remark that the name is different!
 
code of conduct - report abuse