+ 2
Good convention is to name things in a way that describes what it is, so you can look at it and know exactly what it's for without having to guess or search code to remember. It should be done in a way that someone who has never used your code could easily read it and understand. Because of this, it's often good to avoid abbreviations. However, limit the length of the name Example: BAD NAME: id="ThisIsMyIdForTheMainLeftDivElement" GOOD NAME: id = "mainLeftDiv"; In the case of the class, take into consideration that multiple elements will have it, so name it based upon its purpose. For example, if its purpose is to apply a red background, I'd name my class something like redBack or redBackground. I immediately know its purpose without looking, and it's generic enough that it isn't implying one specific element.
29th Nov 2017, 5:12 PM
AgentSmith