Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Javascript's "this" is garbage

Name: Anonymous 2011-08-07 11:38

An example (using chrome console)

> console.log("anus")
anus

> importantInfo = console.log
> importantInfo("anus")
TypeError

This fails because console.log needs a "this" that is console

> importantInfo = console.log.bind(console)
> importantInfo("anus")
anus

No big deal, but this comes up a lot if you do any javascript programming. Something will fail weirdly and it's because the dumb function wants a different "this". As a result, you're constantly binding functions because of uneccessary hidden coupling between things.

Name: Anonymous 2011-08-08 11:12

malloc and scanf are both garbage.  Don't use them if you can help it.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List