I wanna test if a field exist within a map function. If the field exist, it should assign a value to a variable, if not, it should assign an empty string to it. It never change the condition to true even if an object exist (msg variable is always empty). Do you know why?
Object.keys(editorJSON).map((key) => {
if (editorJSON[key].name === "Frage") {
const message = () => {
if (typeof editorJSON[key + 1] !== "undefined") {
const msg = editorJSON[key +
1].data.chatbottext;
return msg;
} else {
const msg = "testantwort";
return msg;
}
};
}
Thank you very much, very appreciate your help
Aucun commentaire:
Enregistrer un commentaire