Coding Conventions

Whatever programming language you are using, you should follow certain standards. Some of the standards are there to help you avoid bugs in your code. For example, in JavaScript, you should always use === (triple equals) instead of == (double equals) because == can have unintended consequences (see Chapter 7, “If, For, While, and When”). Other standards are really just conventions that help keep your code consistent and readable. Some conventions should be followed any time you are writing in a given language. For instance, JavaScript variable names should use camel case (myName), while Python variable names should use all lowercase letters with underscores to separate words (my_name). Underscoring works in JavaScript and ...

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.