I have the following object
{ join: {} }
I'd like to find it's default object from the array below
[
{ login: { label: 'Login', url: '#login' } },
{ join: { label: 'Join', url: '#join', theme: 'a' } },
{ home: { label: 'none', icon: 'home', url: '#', theme: 'a' } }
]
I'd like to loop through the array and match the key, in this case 'join'.
This is what I have so far:
var butt_to_find = { join: {} }
var all_buttons = 'array above'
var matching = _.find(all_buttons, function(default_button){
return if default_butt key @ 1 is the same as butt_to_find key @ 1;
});
This is the first time I've used underscore after hearing so much about it. Any help, more than welcome
label: 'none'. Surelylabel: null(or omitting thelabelproperty) would more be a more accurate way to represent this? As written, I'd expect the word "none" to actually be rendered in the UI.