I have two arrays, one that has the given items that a user has marked and one that holds all items. I want to make a button that pushes all items into the chosen items array. The problem is that, even though this is all the code there is on my side of the project, I am getting a
SyntaxError: missing } after function body
for (let i = 0; i < self.loadedData.length; i++) {
try {
self.selectedItems.push(self.loadedData[i]);
} catch (e) {
console.log(e);
}
}
Please Help and thank you in advance.
I tested another button and just put a console.log in it to see if there might be something else unrelated to my code, but it worked fine there.
I also wrapped the code inside a try-catch block, but I still get the same error.
At this point, I am not understanding what is wrong. I also threw the issue at ChatGPT, but it couldn’t find anything either. Please check for grammar.