var t = Object.prototype.toString;
function isArray (s) { return t.call(s) === '[object Array]'; };
var x = [1,2,3];
if( isArray(x) && x.length > 0 ){ console.log('x is array and length is', x.length)} else { console.log('x isnt array') }
var x = {};
if( isArray(x) && x.length > 0 ){ console.log('x is array and length is', x.length)} else { console.log('x isnt array') }