Object of Objects

 let mahishmathi={

    baahu:{
        role:"prince",
        wife:"devasena"
    },
    balla:{
        role:"Prince",
        wife:"Unknown"
    },
    kattappa:{
        role:"Banisa",
        wife:null
    }
};
console.log(mahishmathi);
// ACCESSING
console.log(mahishmathi.baahu.role);
console.log(mahishmathi.kattappa.role);
// CHANGING
mahishmathi.baahu.role="king";
console.log(mahishmathi);

Comments

Popular posts from this blog

Callback Hell

TODO list with DOM

Refactoring callback hell code