简体   繁体   中英

Chaining in Javascript

could you please explain me this piece of code? Thank you.

items.addItem("a").addItem("b").addItem("c").run();

这是一个流畅的界面的例子。

不确定使用的框架是什么,但是addItem方法返回父实例( return this ),因此您可以在输出时调用另一个方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM