Changes between Version 51 and Version 52 of Coding_Conventions
- Timestamp:
- May 17, 2021, 5:54:28 PM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Coding_Conventions
v51 v52 412 412 }}} 413 413 414 * Use `var` only when declaring variables in the global scope. When inside functions, ifs, loops, etc., use `let` . We prefer `let` because:414 * Use `var` only when declaring variables in the global scope. When inside functions, ifs, loops, etc., use `let` or `const`. We prefer `let` because: 415 415 - It is restricted to the scope it is declared in, preventing unintentional clobbering of values 416 416 - It is stricter than `var`, and throws an error if it a variable is declared twice within the same scope … … 427 427 } 428 428 }}} 429 - We prefer `const` when the value is not intended to be changed. This allows easier readability and is considered good practice to prevent accidental changing of values. 429 430 430 431