3 ms·
In what other language you have direct access to methods as first class objects to do an immediate execution of a method returned by an execution container (par
by jQueryIsAwesome 14y ago
In what other language you have direct access to methods as first class objects to do an immediate execution of a method returned by an execution container (parenthesis in JS) ?
I think most people would write it like this:
playing ? player.play() : player.pause()
- epidemian 14y ago> In what other language you have direct access to methods as first class objects to do an immediate execution of a method returned by an execution container (parenthesis in JS) ? Not sure if i understand the question. This seems to work in Python: s = "Hello" up = True (s.upper if up else s.lower)() Not that it's a very pythonic piece of code, but it works, and i would expect many other languages support something similar. Anyway, that's tangential. And i wasn't discussion what "most people would" do either. What i was trying to say is that by aliasing "var self = this" you're not automatically immune to the quirks of "this" in JS.