Hi there, I'm having some trouble with my code below. I am trying to print the title object from the submenu object, but I keep getting this error: Output: undefined 2 3
Here is the code:
const menu = [
{
title : "1",
submenu :[
{
title : 'gilbert lua',
},
{
title : 'pemai',
},
],
},
{
title : "2",
},
{
title : "3",
}
];
const data = menu.map((e)=> {
test(e.submenu,e.title)
});
function test(e,f){
// const submenu = e.title;
const testing = e? (e.title) : (f);
console.log(testing);
}
Thank you