EDIT: Took out the unnecessary bit
Not sure why i can't call this method - I get an error
"textNodes[1].options.aaah" is not a function:
const textNodes = [{
id: 1,
room_id: 1,
text: '"ZZZZzzzzZZZZZZzzzzzzzzzzZZZZZZZZZZZZZ"',
options: [{
text: "Wake up",
setfadeMode: {
fade: 2
},
nextText: 2,
ahhh() {
console.log("ahhh");
},
}, ],
}, ];
textNodes[1].options.ahhh();
textNodes
here? And what argument would go astextNodeIndex
? What are you trying to perform with the code? Why do you think the index is tied to the ID? Please clarify your question. – AlveMonkeahhh
and notaaah
? – Oluwafemi Suleoptions
contains an array, so something liketextNodes[1].options[0].ahhh()
would work. But really think about whether this is an appropriate data structure - if there really should be a full array of options then why call a method on just one of them? – Robin Zigmond