function a (METRIC,DIMENTIONS){
var args = {
'ids': ids,
'start-date': START_DATE,
'end-date': END_DATE,
'metrics': METRIC,
'dimensions': DIMENTIONS
};
}
I have this array in javascript where dimensions
is an optional value
i want to check if DIMENTIONS
is an empty string i want my args to look like this :
var args = {
'ids': ids,
'start-date': START_DATE,
'end-date': END_DATE,
'metrics': METRIC
};
i tried this :
var args = {
'ids': ids,
'start-date': START_DATE,
'end-date': END_DATE,
'metrics': METRIC,
DIMENTIONS!=''? 'dimensions': DIMENTIONS : ''
};
but this will keep the ,
after METRIC
and will produce an error