var zOrder = 0; // using naive iteration to speed things up a bit by avoiding function call overhead for(var x=0; x<this.cache.length; x++){ zOrder += this.cache[x].z; } return (this.cache.length > 1) ? zOrder / this.cache.length : 0;