I've been doing JavaScript for more than 10 years now, and I just got bitten hard by using for (const x in foo) instead of for (const x of foo). I spent forever trying to figure out why I kept getting numbers wtf lol.

This shouldn't happen jfc. And this is with TypeScript

Follow

@zkat Yeah that's a great one to catch with linter rules. Then for when you want to iterate over keys use Object.keys with for of.

Pre for-of js was so much more annoying IMO. V happy with how the language has evolved

Sign in to participate in the conversation
Mauvestodon

Escape ship from centralized social media run by Mauve.