javascript add property if not undefined