This is simple but I have no idea where I am going wrong. Could you please let me know how I use the returned data. I have been calling
favorites[0].name but I get no response.
person.favourites=function(){
return [
{
'name'= 'Gmail',
'link'= 'www.gmail.com'
},
{
'name': 'Facebook',
'link': 'www.facebook.com'
}
];
};
You need to call your function, using
person.favourites(), instead of referencing it withperson.favourites: