I just want to return a string from an array in vue. I made method like this:
displayFixturesName() {
const result = this.selectedFixture.toString();
document.getElementById('resultFixture').innerHTML = result.join()
}
this.selectedFixture is an array of my selection
and I display it like this
<p class="subtitle" id="resultFixture">{{displayFixturesName()}}</p>
Finally, I have a message in my console and it doesn't work-
[Vue warn]: Error in render: "TypeError: result.join is not a function"
join()is a function which works only witharraybut you used it onstring(because you have usedtoString()function before).resultis already a string, why don't you simply print it?joinis an Array method. Otherwise, ifthis.selectedFixtureis an array, just dothis.selectedFixture.join(). In any case, using a method is not the cleverest approach in any MVC framework..join(', ');