Javascript Get First Element Of Array Or Null