Hacker News new | ask | show | jobs
by alternatex 756 days ago
I had someone on Reddit r/webdev try to convince me that 'this' was not a mistake but a powerful language feature. A small glimpse into the mind of JS fans.
3 comments

Sounds like something any programmer would say about their preferred language. Can't say you don't hear similarly crazy things about C, or C++, or Java.
True. But it's generally only common with older C-based languages where the goal was packing as many features as you can instead of high level design aimed to guard software from inexperienced overeager devs.
It kinda is a powerful language feature But with great power comes great responsibility, and that doesn’t mean it was a good idea in hindsight.
Yes, it's functions vs methods. You can make this explicit like in Python, you can make it implicit but have two kinds of methods, instance methods and static methods like in C++/C#/Java.

And you have JavaScript were all functions have an implicit this ...

If it didn't exist, people would come up with weird hacks to implement the few cases where you do need it. But those are rare.