This is down to changes that were made for new versions of ZPE.
Put simply, an array is a collection of other items. In programming, an array can be seen to similar to the way that variables are stored in memory. In this sense, there is a direct mapping between the variable name or index and the value.
Arrays are incredibly useful ways of storing lots of information in one easy to access place. Not only this, unlike 1-dimension variables (all variables used in this tutorial), array values can be defined at runtime.
As mentioned, arrays can be seen as maps:
An array provides a map from the left (index or key) to something on the right (value)
An array is declared as follows:
var array = ;
This defines an empty array. An array does not need to be empty to start with, as shown below an array can contain elements upon instantiation:
var names = ['Jamie', 'Balfour'];
Adding elements to the array can be done in two ways. The first of those is to simply specify an index for the element and assign a value to it:
var names = ['Jamie', 'Michael']; names = 'David'; alert(names);
The alternative to adding an element this way is to consider the array as a stack structure, whereby everything follows a first in first out system:
var names = ['Jamie', 'Michael']; names.push('David'); alert(names);
var names = ['Jamie', 'Michael']; alert(names);
length of the array. This allows you to check how many elements there are in an array:
var names = ['Jamie', 'Michael', 'David']; alert(names.length);
S1s and S2s really enjoyed the lesson on cybercrime using the lesson on How to Rob A Bank on… https://t.co/MxjDYE2JFu
7 months ago
S2s doing really well in hardware test! Also really enjoying doing tests electronically rather than on paper.… https://t.co/ritdfcW6Mw
7 months ago
S1 and S2 pupils listing input and output devices and giving answers such as keyboard and mouse but there were also… https://t.co/dGxDkYqFxo
8 months ago