Hello everyone, I am having a strange issue.
addToCart(e) {
console.log(e.target.id)
let tempcart = []
tempcart.push(e.target.id)
console.log(this.tempcart)
}
I am trying to add the id of whatever is clicked to an array, when I console.log() it it shows me the id no problem. However when I try and add it to an array, it returns undefined.
What is going on? Why is it not adding the id to the array?