In the below example, when using getData();
, is it possible to access the data contained in its object map within a new function – ie. useData();
– that is an argument of getData();
?
const getData = (useData) => {
const myData = {
0: { title: 'Hello' },
1: { title: 'World!' }
};
Object.keys(myData).map((item) => {
useData();
});
}
getData(console.log(
/**
* Somehow access data represented by `myData` and `item`
* in above object map along the lines of `myData[item].title`
*/
));
via lukebm
No comments:
Post a Comment