I have the following object, for example:
{
"name":"false",
"var_RadiacionGlobalInt":true,
"var_CO2InvVaisala":true,
"var_RadiacionExt":false,
"var_VVExt":false
}
I would need to go through that object and the elements that are true to add them to a new array with a push. This is the code that I have implemented:
public guardar(){
this.checkboxsensores = [];
for (let variable in this.checkbox) {
if (variable === 'true') {
this.checkboxsensores.push(variable);
}
}
}
I need a final format like this:
["var_RadiacionGlobalInt", "var_CO2InvVaisala"]
I can not search by the value true only by the name of the field, how can I filter by Booleans?
Greetings.