I tried this:
get_choices: function (item, index){
console.log(item)
},
this.questions.forEach(this.get_choices())
But it says
Error in mounted hook: "TypeError: this.questions.forEach is not a function"
I also tried:
for(question in this.questions){
console.log(question)
}
But it didn't output anything, it didn't also displayed any error. Any help? Thanks a lot!
UPDATE:
Here's the this.questions. It is an array of objects:
data: {
questions: [
{'name': 'etc', 'content': 'etc'},
{'name': 'etc2', 'content': 'etc2'},
],
},
this.questions? It doesn't appear to be an array or anything foreachable.this.questions.forEach(this.get_choices)forEachisn't recognised as a method that exists onthis.questions. Passing the function reference wouldn't help with that problem.this.questionsis an array and then pass the function as I mentioned