Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on V8 Release v9.4. Parent comment
I've found understanding exactly how JS works to become more confusing with class structures.
It feels like you need a PHD in JS to have a good grip on how it all works under the covers.
Using Crockfords closure strategy for me was quite straightforward and simple, and I've enjoyed doing:
const MyClass = {}; MyClass.new = () => {}; const instance = MyClass.new();
Which leaves all the "this." ugliness behind and provides a ruby-like instantiation.
There are no comments on this comment yet.
I've found understanding exactly how JS works to become more confusing with class structures.
It feels like you need a PHD in JS to have a good grip on how it all works under the covers.
Using Crockfords closure strategy for me was quite straightforward and simple, and I've enjoyed doing:
const MyClass = {}; MyClass.new = () => {}; const instance = MyClass.new();
Which leaves all the "this." ugliness behind and provides a ruby-like instantiation.