<script type="text/javascript"> //实现类似jquery调用方法的连续调用 var zhang = { game:function(){ console.log("game..."); return this; }, sleep:function(){ console.log("sleep..."); return this; }, watchingLive:function(){ console.log("watchingLive..."); return this; } } zhang.game().sleep().watchingLive() </script>
对象中return this实现方法的连续调用