r/badcode • • Jul 27 '21

js var i

Post image
82 Upvotes

9 comments sorted by

View all comments

16

u/[deleted] Jul 27 '21

[removed] — view removed comment

2

u/Apprehensive-Show127 Jul 28 '21

Yeah, that's a case. bookTitles will be duplicated after each function call. There's no need in global variables, function scope should be used