JSFiddle - React, Tailwind, and code Playground
by luka kupunia
JavaScript
var isActive = 1;
var table = {
buttons: {
button_1: {
id: 1,
name: "button 1"
},
button_2: {
id: 2,
name: "button 2"
},
button_3: {
id: 3,
name: "button 3"
}
},
content: {
text_1: {
id: 1,
text: "hello text-1"
},
text_2: {
id: 2,
text: "hello text-2"
},
text_3: {
id: 3,
text: "hello text-3"
}
}
}
function tableActive() {
return Array.from(Object.values(table.content)).filter(key => {
return key.id === isActive
});
}
tableActive();
/* console.log(Array.from(Object.values(table.content)).filter(key => console.log(key.id))) */