I want to push object into array if it is defined else push '0'
I am sending count object into count array.
var emptyObj = { 'cnt': 0 };
countArr.push(matchCdnCnt !== 'undefined' ? matchCdnCnt : emptyObj.cnt);
countArr.push(matchInvCnt !== 'undefined' ? matchInvCnt : emptyObj.cnt);
countArr.push(mismatchInvCnt !== 'undefined' ? mismatchInvCnt : emptyObj.cnt);
countArr.push(mismatchCdnCnt !== 'undefined' ? mismatchCdnCnt : emptyObj.cnt);
countArr.push(onHoldInvCnt !== 'undefined' ? onHoldInvCnt : emptyObj.cnt);
countArr.push(onHoldCdnCnt !== 'undefined' ? onHoldCdnCnt : emptyObj.cnt);
countArr.push(availgstnInvCnt !== 'undefined' ? availgstnInvCnt : emptyObj.cnt);
countArr.push(availgstnCdnCnt !== 'undefined' ? availgstnCdnCnt : emptyObj.cnt);
countArr.push(pendingInvCnt !== 'undefined' ? pendingInvCnt : emptyObj.cnt);
countArr.push(pendingCdnCnt !== 'undefined' ? pendingCdnCnt : emptyObj.cnt);
I wants to push count object or 0.
'undefined'andundefinedare not the same.countArr.push(matchCdnCnt || emptyObj.cnt)