How do we add 2 GameObjects to an Array

Hi there, I am trying to add 2 Gameobjects to an GameObject array, but it says it :

Assets/WeaponScripts/SentryGun_plr.js(33,22): BCE0022: Cannot convert ‘UnityEngine.GameObject’ to ‘UnityEngine.GameObject

In the latter code it takes a GameObject and finds the closest one.

So, how to I add 2 Gameobjects to an GameObject array.

function FindClosestEnemy (): GameObject {

        var moblist : GameObject[];

        moblist = E1 && E2;        

        var closest: GameObject;

        var distance = Mathf.Infinity;

        var position = transform.position; 
    
    for (var mobcheck : GameObject in moblist) {
    
                var diff = (mobcheck.transform.position - position);
    
                var curDistance = diff.sqrMagnitude;
    
                if (curDistance < distance) {
    
                    closest = mobcheck;
    
                    distance = curDistance;
    
                }
    
            }
    
           
    
            return closest;
    
        }

E1 and E2 are FindWithTags.

You can’t use arrays like that, you have to define a size when you create the array. It also works if you assign content to the array when creating it.

var moblist = [E1, E2];

&& is used for boolean operations, you can’t combine objects with it.