Reputation: 941
I have an array and am adding to this array a JavaScript object.
var channels = [];
var channel = {
id: data.channels[i].id,
name: data.channels[i].name,
head_name: groups[data.channels[i].group-1],
show_title: show_group_title // var show_group_title = false;
}
channels.push(channel);
Now I want to change the show_title of the first array from false to true. How I could do that?
Upvotes: 0
Views: 68
Reputation: 119
I don't understand what behavior do you expect... Do you need something like this?
var channel = {
id: data.channels[i].id,
name: data.channels[i].name,
head_name: groups[data.channels[i].group-1],
show_title: function() { return groups_show_title[data.channels[i].group-1]; }
// or just
// show_title: groups_show_title[data.channels[i].group-1]
}
This code needs an additional array.
Upvotes: 0