This page is very seimple to show you how to check if array element already exists and has a value or not. This is a simple code to check if an element in an array already has a value and exists .

if(typeof myArray[index] === "undefined") {
    //NO!  Element does NOT exist in Array
else {
    // YES! Element already does exist in array