JavaScript Program Create an Array Fruits and Display it in Message Box

Write a JavaScript that initialises an array called “fruits” with names of five fruits. The script then displays the array in a message box.

Source Code
    <title>Array of fruits</title>
    var fruits = [];

    fruits[0] = 'Apple';
    fruits[1] = 'Orange';
    fruits[2] = 'Kiwi';
    fruits[3] = 'Banana';
    fruits[4] = 'Pineapple';

    alert("Fruits array is: " + fruits);