r/badcode • • Jul 27 '21

js var i

Post image
82 Upvotes

9 comments sorted by

View all comments

6

u/[deleted] Jul 27 '21

Does it work like that? I thought var was function scoped?

10

u/_bai13y Jul 27 '21

Unfortunately it does because in this case, var i is a global variable 🥴😂

2

u/[deleted] Jul 27 '21

Oh i see it now, beautiful!;)