18
lxmcf
6y

Just spent 2 fucking hours debugging one of my websites scripts because apparently appendChild wasn't a function... Here I was thinking there was a function called getElementByClassName... Dick head me didn't realise I'm missing a single 's'... 2 hours over a single fucking s!

Fuck javascript man...

Comments
  • 7
    Don’t beat yourself up over it.

    ...Here! Have some extra semicolons for when you forget those, too.

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  • 2
    @BrainDrain haha, was just so annoyed at myself for such a simple mistake...

    And ahhhh, can never have too many spare semi colons
  • 3
    How is that a JS fault? Try writing to stout and then blame the tooling... :p
  • 1
    I think vscode automatically shows not known function names, though not sure if via plugin or default, you could try it next time, to avoid hunting it so long 😄
  • 2
    If your editor doesn't make a red squiggly when trying to access things that don't exist, you need to look over your tooling.
  • 1
    @Glinkis but in javascript the editor cannot know if something doesnt exist
  • 1
    @host127001
    Well, it depends. For the DOM, like in the OP's example, you should be able to get the editor to help you out

    And for the rest you can use jsdoc comments, which allows many editors to reason about your javascript.
  • 1
    @host127001 in addition to @glinkis comment, if you use flow or typescript then your ide can be even more helpful.
  • 1
    @destriaero
    I do use Typescript, and perhaps that's the reason I find things like this out of the ordinary.
  • 1
    @JoshBent no it doesn't :-(
    Well isn't for me lol
  • 0
    @lxmcf It had to be a plugin then it seems, wish I knew which one it was, as I had tons of them installed before I had to reinstall windows
  • 1
    @JoshBent damn, I'll have to hunt one down, really hate not having proper error highlighting in vs code itself, oh well, I'll live haha
Add Comment