Array demonstration

Example output

The JavaScript code