I have the code bellow and I'm trying to console.log the information from message of each array. The problem is there are some undefined "payload". What can I do to ignore the undefined values and keep iterating through the arrays?
const repositoriesActivities = await getUserActivities(userName)
for (let i = 0; i < repositoriesActivities.length; i++) {
let activities = repositoriesActivities[i].payload.commits[i].message;
if (activities !== undefined){
console.log(activities)
}
}