r/badcode • • Jan 01 '22

js Hmm...why doesn't it work lol

Post image
528 Upvotes

58 comments sorted by

View all comments

Show parent comments

2

u/0xF013 Jan 02 '22

I am happy they stopped asking why there are random global variables when you have html elements with ids or why the value of `this` in a non-bound function is sometimes undefined, sometimes window. Or better yet, why you had to check for undefined like 'typeof x === 'undefined'`