Have you ever had a coding black-out?


A month or so ago, I was trying to split a string, but no matter what that string had in it, the split method just returned undefined. I spent 2 hours trying to figure out why I couldn't get it to work. I finally posted on a Slack team asking why it wasn't working. Turns out, I was using square brackets instead of parentheses for no discernible reason. It was pretty embarrassing, especially considering how long I've been writing JS.

Show all replies

Yup, side effect of every function and method ALSO being an object unto itself, and being able to index a object for properties like it was an array. That'll nab you every time because JS won't even report it as an error because it IS a valid construct, just not the one you wanted. :/

I get that switching back and forth between Wirth and C syntax with the differences between :=, =, and ==. Or how having my first high level languages being Wirth style the concept of block-locals being outright alien even after some twenty years of working with C.

Sometimes it's just hard to forget what you learned first.

Reply to this…

(9 answers) Take me to the question