Sorry to point this out, but about half of this advice are bad.
3 hungry && goToFridge() - no. Your code is written once and then read 10 times. This makes it harder to read.
hungry && goToFridge()
4 And now you can't have 0... Use default args.
function doSomething(arg1 = 32){ //.... }
If you are dealing with variables - use nullish coalescing operator.
a = a ?? 32;
5 'Coma operator' - don't use it as described ever. It is a constant source of bugs.
6 'Using length to resize an array' - try avoiding this. It is a hack that hides intentions and leads to bugs.
P.S. 1
const args = Array.from(arguments); // just make sure to polyfil if you expect older browsers
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Sorry to point this out, but about half of this advice are bad.
3
hungry && goToFridge()
- no. Your code is written once and then read 10 times. This makes it harder to read.4 And now you can't have 0... Use default args.
If you are dealing with variables - use nullish coalescing operator.
5 'Coma operator' - don't use it as described ever. It is a constant source of bugs.
6 'Using length to resize an array' - try avoiding this. It is a hack that hides intentions and leads to bugs.
P.S.
1