[Vuejs]-How do i push a variable after using split function in javascript?

0👍

By this way this.name[i].push(arrayData[0]); you are trying to push an element into another element this is why you have that error.

this.name is the tab and this.name[i] is one element so it should be this.name.push(arrayData[0]);

0👍

you don’t have any element in the name array therefore you should push like this.

this.name.push(arrayData[0]);

0👍

You probably need to assign instead of pushing, i.e.

this.name[i] = arrayData[0];

(Although I can’t be sure. If you defined example input data and desired output, that would be helpful).

Leave a comment