re: Function.bind.bind does not work in JavaScript VIEW POST


Of course, no one would write code in f.bind(x).bind(y) point was that behavior was unpredictable. I was trying to optimize event handlers and I accidentally used bind on bound function and found out that I shouldn't have used bind.

this is powerful, I know lot of people talking about not using this, but it is just unnecessary complicated syntax for no real benefit.

point was that behavior was unpredictable

I am in complete agreement!

I wasn't in disagreement with your article, but the commenter.


Why even suggest eliminating/eradicating the use of this then? Are there any true Javascript experts recommending this? Douglas Crockford, John Resig, somebody at THAT level? John Resig even uses with as deemed necessary (Javascript templates, anyone?), despite everybody parroting howls of derision. There's no sense throwing a good tool such as this out, like a baby with the bath-water.

Are there any true Javascript experts recommending this?

Why does someone of influence have to recommend it for you to become a follower?

There's no sense throwing a good tool such as this out, like a baby with the bath-water.

There is no baby/bathwater. this is a cancer that needs to be excised.

this in other languages like C# has no problems. But this in JavaScript much more complex in comparison for people to reason about. People come from other languages expecting Class to behave in a similar way to their language... and it doesn't.

this is fairly complex to understand completely, which is demonstrated (in a small part) by this article and many many other articles.

In JavaScript, this is nothing more than an optional argument. So if you need this argument, why not just supply it as an argument?

You don't have to ever worry about what this is if you never use it ;)

Never type console.log(this) ever again.

I've heard of eating your own dogfood before, but not drinking your own Kool-Aid. Seriously I've had a look at "nothis". It's verbose, it's implicitly magical, all it does is replace this with ctx, etc. These are not formulas for success in my opinion.

It promotes the context from the side loaded this to a full fledged variable.

This behaves in a way similar to ReasonReact.

It is used as a last resort for when you must use this.

The first and best option is to write your software without this.

If this in JavaScript would be same as in other language, why would someone use JavaScript? Power of JavaScript is due to this, otherwise, all nothis and such things are also possible in other languages as well with some tweaks. There is no fun in not using this.

this is cancer only for you, not for everyone !! And it will not become cancer for everyone by shouting it out loud.

Power of JavaScript is due to this

Disagree. The power it JavaScript is it runs almost everywhere. It's power is also in it's flexibility on how you like to code. this causes more problems than it solves.

this is cancer only for you

False. Read stack overflow. Google. You'll find many thousands of posts with people having problems with this.

Just because thousands of programmers have a hard time reasoning about threads in Java, should they be eliminated?

If there are roads to take and one causes less flat tires, which road would you choose to take?

code of conduct - report abuse