arr = [
{
"id": 1,
"type": "internal",
"text": "Text",
"checked":false,
"disabled":false
},
{
"id": 2,
"type": "external",
"text": "Text2",
"checked":true,
"disabled":false
},
{
"id": 3,
"type": "internal",
"text": "Text3",
"checked":false,
"disabled":true
},
{
"id": 4,
"type": "internal",
"text": "Text4444",
"checked":false,
"disabled":false
},
{
"id": 5,
"type": "external",
"text": "Text55555",
"checked":true,
"disabled":true
}
];
function diffByType(arr){
var out = [[],[]];
arr.forEach(function(elem){
out[+(elem.type === 'external')].push(elem);
});
return out
}
alert(JSON.stringify(diffByType(arr),null,'\t'))