function filter(values) {
return values.filter(function (value) {
if (value instanceof Array) {
return value.length > 0;
}
if (value instanceof Object) {
return JSON.stringify(value) !== '{}';
}
return !!value;
});
}
var resultArray = filter([1, 'abc', [], ['a'], {}, {name: "ololo"}, null, 0]),
resultString = JSON.stringify(resultArray);
alert(resultString);