r/shittyprogramming • • Mar 10 '23

Javascript is hard sometimes

Post image
504 Upvotes

64 comments sorted by

View all comments

Show parent comment

1

u/T351A Mar 11 '23

my issue is imagine getFoo changes types for some reason... something something legacy code ಥ_ಥ

anyways... with "var", the error will occur when accessing instead of when defining. this makes debugging harder but also introduces the risk of theoretical corruption when types are compatible but used differently.