How to check contents in arrays

hi all,
I’m trying to do a memory game and the problem I have is I don’t know how to check the contents in the arrays.

Here’s part of the code:
function createNewOrder() {

for (k=0; k<=numberOfKeys; k++) {
    onEnterFrame = function () {
        randomNumber = Math.floor(Math.random()*5);
        if(isNotAssigned(randomNumber)){
        order.push(randomNumber);
        trace(order);
        } 
        if(order.length >= 5){
            delete onEnterFrame;
        }
        
    };
}

}

function isNotAssigned(numCheck) {
if (order !== numCheck) {//I think this part is the problem.
return numCheck;
}
}

Anybody knows what I’m talking about? Perhaps I need to explain better