r/programminghorror • • Mar 31 '26

Javascript HELL

Post image
3.1k Upvotes

80 comments sorted by

View all comments

Show parent comment

2

u/edave64 Apr 02 '26

It does set height to be the same thing as width.

If you're asking why there isn't a height variable, personally I would avoid two variables having the same value, because having two variables implies that the value might be different, and opens the door to programming errors where the values might become different.

Although I would probably throw in a quick // square to make that clear, since setting height to width does look like an error.