for (i = 0; i < document.querySelectorAll('span.movie-cast-title').length; i++)
{
if (document.querySelectorAll('span.gcharacter')[i].innerText, == 'null') {
continue;
}
data.actor.push({
"@type": "PerformanceRole",
"actor": {
"@type": "Person",
"name": document.querySelectorAll('span.movie-cast-title')[i].innerText,
"url": document.querySelectorAll('a.movie-cast-url')[i].href,
}
"characterName": document.querySelectorAll('span.gcharacter')[i].innerText,
});
}
how to skip queryselectorall does not exist or null
“characterName”: document.querySelectorAll(‘span.gcharacter’)[i].innerText