访问父函数参数

时间:2016-11-14 16:27:23

标签: javascript

我已获得以下代码:

function xyz() {
    this.particles = [];

    this.particle = function (x, y, velocityX, velocityY, color) {
        this.x = x || 0;
        this.y = y || 0;
        this.velocityX = velocityX || 0;
        this.velocityY = velocityY || 0;
        this.color = color || "#000000";
        this.next = function () {
            this.x += this.velocityX;
            this.y += this.velocityY;
        };
    };

    this.drawParticles = function (particleArray) {
        particleArray = particleArray || /* I WANT TO HAVE particles here */;
    }
}

在drawParticles中,我想访问我在父函数中定义的数组。有人能告诉我我是怎么做到的吗?

0 个答案:

没有答案