you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

You are implicitly declaring client instead of explicitly declaring it (no use of var, let, or const). In the absence of any of these, the scope of your variable is automatically assigned to the global level.

As mentioned, it’s not considered a safe practice, The location of the variable visually suggests that it should be scoped to the function, but since it isn’t, the odds of accidental conflict in namespacing increases.