1 |
if( obj[0] ) |
a cleaner version of this might be:
1 |
if( typeof Object.keys(obj)[0] === 'undefined' ) |
where the result will be undefined if no object property is set.
1 |
if( Object.keys(obj).length > 0 ) |
as an extra option.
1 |
if( data instanceof Array ) |
or
1 |
if( data instanceof Object ) |
No Comments