Javascript first example 1

Javascript first example

var array = [];


array.push(value);

Here is what the above code is Doing:
1. We create an empty array called array.
2. We use the push() method to add the value “red” to the end of the array.
3. We use the push() method again to add the value “green” to the end of the array.
4. We use the push() method a third time to add the value “blue” to the end of the array.

Similar Posts