For more reference: {{
let LinksArray = [];
// Check if the selected row and emailsQuestions exist
if (table2.selectedSourceRow && table2.selectedSourceRow.emailsQuestions) {
let emailsQuestions = table2.selectedSourceRow.emailsQuestions;
for (let i = 0; i < emailsQuestions.length; i++) {
let email = emailsQuestions[i];
// Check if the Provenance and reference exist for this email
if (email.Provenance && email.Provenance.Reference) {
let reference = email.Provenance.Reference;
for (let j = 0; j < reference.length; j++) {
let currentReference = reference[j];
// If Object.keys is available and is a function
if (typeof Object.keys === 'function') {
let keys = Object.keys(currentReference);
if (keys.length > 0) {
LinksArray.push(`<a href="${keys[0]}" target="_blank">link${j + 1}</a>`);
}
} else {
// Fallback: Using for...in loop if Object.keys is not available
for(var key in currentReference) {
if (currentReference.hasOwnProperty(key)) {
LinksArray.push(`<a href="${key}" target="_blank">link${j + 1}</a>`);
}
}
}
}
}
}
}
return LinksArray.join(", ");
}}
here is my code, I am not able to get all the keys of an object using Object.keys . Can some buddy guide me here . Here is the sample data on which i am trying this code object =
{
"Automated & Manual Accessibility Testing | Level Access": 50
},