- [CODE STYLE]: don't use
for in
loop for iterating over array - [CODE STYLE]: Use
switch
statement if you have limited amount of conditions. - [NAMING]: use proper variable names in
for of
loop
BAD EXAMPLE:
for (let item of actions) {
GOOD EXAMPLE:
for (const action of actions) {
- [CODE STYLE]: switch/case should always have default case for error handling.
- [CODE STYLE]: Nested loops === EVIL
- [CODE KNOWLEDGE]: Remember, if property key is a variable - use brackets
object[key]
. If it's called key - use dot accessobject.key
.