By pressing the first button, 'splitit' is called.
One way to create an array is, to use the String 'split' method, that parses a string on the delimiter given, so here each city name will end up as an array element.
The default sort results in uppercase first, followed by lowercase.
As our function 'showarr' shows in the textbox.
Every array has 'length' containing the number of elements in the array.
The 'push' method allows you to append an element to an array, the 'pop', on the other hand, removes the last element from the array.
There's also an 'unshift' and a 'shift' to insert to or remove from the start of an array, but keep in mind that this changes the indexes of the elements already there.
By entering a city and an index we can replace an existing element in the array.
To have the array sorted irrespective of case, we have a special function to that end.
This function is the argument to the sort command and is called automatically and repeatedly with two elements from the array passed in each call.
By declaring the array name, or pointer, rather, outside of the functions ....
it's accessible to all functions, it is global,...
as opposed to local. To ensure a variable is local to a method, the keyword 'var' is essential.
'null' means 'arr' doesn't refer to an object yet.
Disabling or enabling a button, or any control, for that matter.