js method chain tail
问题 is there a way to detect if a method call in a chain (fluent interface) is in TAIL position in that chain ? var some = g.f(arg1).f(arg2).f(arg3); or do we absolutely need something like var some = g.f(arg1).f(arg2).f(arg3).end(); which I want avoid ? REturned value is not so important for me, but I need to compute something (an internal string-like key) at the end of the chain, with could have different lengths from one call to another. 回答1: No, there is no way to detect if a given method is