javascript get array element if exists