2 lines
496 B
JavaScript
2 lines
496 B
JavaScript
|
define((function(){"use strict";return function(){let t,n,e=function(t){this.ele=t,this.next=null},i=0;this.push=function(u){let r,l=new e(u);return 0==i?t=l:(r=n,r.next=l),n=l,i++,!0},this.shift=function(){let n=t;return t=t.next,i--,n.next=null,n.ele},this.size=function(){return i},this.getFront=function(){return t.ele},this.getRear=function(){return n.ele},this.toString=function(){let n="",e=t;for(;e;)n+=e.ele+" ",e=e.next;return n},this.clear=function(){return t=null,n=null,i=0,!0}}}));
|