This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.

Smartphone icons created by Freepik - Flaticon

JavaScript Arrays

The push() Method

The push method appends a new element to an array.

const fruits = ["Banana", " Orange", " Apple"];
document.getElementById("demo").innerHTML = fruits;

function myFunction() {
  fruits.push(" Lemon");
  document.getElementById("demo").innerHTML = fruits;
}