Returning an array from a class method?

on the frames default:

Bullet = class {
constructor(angle, speed, damage) {

  this.speed = speed;
  this.angle = angle;
  this.damage = damage;

}

move(myself) {
myself.x += Math.cos(this.angle) * this.speed;
myself.y += Math.sin(this.angle) * this.speed;
}
destroy(myself) {
if (myself.isClone) {
myself.remove();
}
}
};

Enemy = class extends Shooter {
constructor(myself, hp, maxHp) {
super(myself);
this.maxHp = maxHp;
this.hp = hp;
}

takeKnockback(myself,x1,y1) {
    myself.x += ( ( myself.x+(Math.cos(this.getAngle(myself,x1,y1)*4) ) )-myself.x )/4
    myself.y += ( ( myself.y+(Math.sin(this.getAngle(myself,x1,y1)*4) ) )-myself.y )/4
    
}
isColliding(myself,ob) {
    
    for(var a of ob.clones){
        if (myself.hits(a)) {
            let out = [true,a]
            return [true,a]
        }else{
            let out = [false,null]
            return out
        }
    }
}

};

on my enemy clip
if(this.isClone){
this.x = p.x
setTimeout(()=>{
this.ready = true
},1000)
if(this.ready===true){
var collision = this.e.isColliding(this,pbullet)
console.log(collision[0])

it should be returning the clone of the bullet that it got hit by, but its logging undefined

Bullet = class {
constructor(angle, speed, damage) {

  this.speed = speed;
  this.angle = angle;
  this.damage = damage;
}

move(myself) {
myself.x += Math.cos(this.angle) * this.speed;
myself.y += Math.sin(this.angle) * this.speed;
}
destroy(myself) {
if (myself.isClone) {
myself.remove();
}
}
};

Enemy = class extends Shooter {
constructor(myself, hp, maxHp) {
super(myself);
this.maxHp = maxHp;
this.hp = hp;
}

takeKnockback(myself,x1,y1) {
    myself.x += ( ( myself.x+(Math.cos(this.getAngle(myself,x1,y1)*4) ) )-myself.x )/4
    myself.y += ( ( myself.y+(Math.sin(this.getAngle(myself,x1,y1)*4) ) )-myself.y )/4
    
}
isColliding(myself,ob) {
    
    for(var a of ob.clones){
        if (myself.hits(a)) {
            let out = [true,a]
            return [true,a]
        }else{
            let out = [false,null]
            return out
        }
    }
}
};

// on my enemy clip
if(this.isClone){
this.x = p.x
setTimeout(()=>{
this.ready = true
},1000)
if(this.ready===true){
var collision = this.e.isColliding(this,pbullet)
console.log(collision[0])

it should be returning the clone of the bullet that it got hit by, but its logging undefined

  1. this,pbullet, does this look wrong?
  2. Your code is unreadable. Try renaming variables from i and a to iterator and enemy.
  3. You are drowning yourself in inheritance.

You could also extend the Clip together.

class Bullet extends Wick.Clip {
  constructor(clip, speed, rotation, damage) {
    super();
    this.addChild(clip);
    this.clip = clip;
    this.speed = speed || 10;
    this.rotation = rotation || 45;
    this.damage = damage || 5;
  }
  xy(x, y) {
    this.x = x;
    this.y = y;
  }
  xyp(x, y) {
    this.xy(this.x + x, this.y + y);
  }
  move() {
    this.clip.xyp(Math.cos(this.rotation) * this.speed, Math.sin(this.roatation) * this.speed); // WickTools behavior.
  }
}