hi! why i get this? if i dont use .pop everything ok.
.pop() is a method for array,
currentCard is not an array. Its a string (see line 6)
Thank you. Is it an array at global scope and a string at block scope?
No, at line 1 you have the array called
cards. you can use pop on this.
line 6 is where you take a random item of the array
cards on line 1. Since the elements in the array are strings the variable on line 6 becomes a string.
because you are popping
currentCard and not cards,
pop() does not work.
If your goal is to clean out
currentCard you could just reset it as
currentCard = "" or if you do want
currentCard to stay an array you would need to use
append() instead of
currentCard = cards[math.floor(....)]
Can you do this: Yes. Do you currently have it? No. Should you do it? No, having two variables with the same name can be very confusing.