And I have an array of objects in javascript:
var array =
[
{
conta_id : "7",
marcar : 1,
pag_data_emissao : "04/08/2015",
pag_debito_credito : "D",
pag_historico : "CHEQUE 331107 VENDA S",
pag_id : "47782",
pag_utilizado :"VENDA S",
pag_valor : "7.000,00"
},
{
conta_id : "7",
marcar : 0,
pag_data_emissao : "07/08/2015",
pag_debito_credito : "D",
pag_historico : "DEPOSITO 3117 VENDA X",
pag_id : "47783",
pag_utilizado :"VENDA X",
pag_valor : "640,63"
}
];
I would like to filter the array with the .filter () method where I would return all objects that have the attribute == 1, but I only found literature and English so I could not understand how it would look.
var a = array.filter(function(obj){ obj.marcar==1; });
With the above code it does not give an error but it does not bring me anything either.