I am trying to check if the string is null or empty. If it is null or empty, then trying to assign default value as '1'. I tried below but it does not work.
var url = 'http://www.test.com?';
var concatResult = url +
"&firstname=" + viewer[1] ? viewer[1] : '1' +
"&tableId=" + this.id ? this.id : '1';
The output of concatResult is empty "" which should not be empty.
I would really appreciate your help. Thank you!