0👍
Welcome on Stack!
I am not sure what you are trying to do, however for sure, if you iterate over the array with index you should use <
not <=
like:
for(i=0; i<this.usernames.length; i++)
Otherwise, in last iteration you are out of index range. This is because index starts with 0
, so last index is array length – 1.
2nd thing is that I am not sure if this update
inside loop will work as this is asynchronous function (reference). I suggest to create whole field and than update it in one update
statement.
I hope it will help!
- [Vuejs]-AWS Amplify API in VueJS – How is apiName formed?
- [Vuejs]-Add Cancel Button to Form, bypassing Validation in Vue.js
Source:stackexchange.com