How to add values to array?

I have an array called Banana, it has in it at the start four values: 0:a 1:b 2:c and 3:d. I want to code to add another value to the array 4:e. This is just a simplified version as for the code I am writing at the moment I need an array to save the values of buttons the user inputs.

The code would work like this in Python but not in wix; how do I add a value to an already established array if possible? This example just says that I cannot use Banana again or refine a variable despite the fact that variables should be able to vary.

Thank you.

You would utilise array.push()
https://www.w3schools.com/jsref/jsref_push.asp

in regards to your code

let banana = ["a", "b", "c","d"]
banana.push("e")

console.log(banana)
//expected output = ["a", "b", "c", "d", "e"]

Thank you so much.

@anralore No worries at all, if you’re happy with the response please mark as the correct answer as it helps future searches.

Done so.

Also, you can’t declare the same variable twice - that is:

let banana = <stuff>
let banana = <other stuff>