Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在做这样的事情:
new A() ..methodA() ..methodB() .toString();
这应该返回结果toString()吗?目前它正在返回新A对象。
toString()
A
在您的代码toString()中应用于methodB(). 这就像你在做:
methodB()
var func = (o) { o.methodA(); o.methodB().toString(); return o; }; func(new A());
要做你想做的事,你必须做类似的事情:
(new A() ..methodA() ..methodB()).toString();