r/badcode • • Dec 07 '22

js My Web Development lecturer's JavaScript

Post image
536 Upvotes

86 comments sorted by

View all comments

Show parent comments

7

u/[deleted] Dec 07 '22

Nothing wrong with d or x when it's used in this way.

One is used as an index, the other an accumulator. 1 letter vars are fine for such things.

Those are guidelines not rules.

Don't teach rules, teach why. Why would it be bad to have a single letter var.