Take the 2-minute tour ×  let say i want to do this    var
dasboard = {};   var page = "index";
$(this).toggleClass("active").siblings().slideToggle('slow',
function() {         dashboard['pages'][page][$(this).closest('l
i').attr("id")]['show'] = $(this).is(":hidden") ? 'collapsed' :
'expanded';  i get an error saying 'dashboard.pages is
undefined'  is there away to dynamically add 'pages' and the
children that follow without having to do the work of checking
to see if it is defined first then if its not doing
dashboard['pages'] = {};  because sometimes they may already
exist and I don't want to have to inspect the tree first i just
want to build the branches as needed  EDIT I changed 'pagename'
to page to show that page names will change and alo I want to
point out that the pages could really be anything too. the idea
is that you have any object that can contain ojbjecs with
parameters without checking to see if the branches exist  it
looks like $extend as stated will be the way to go just not sure