This has been incredibly frustrating, especially given the simplicity of it. Simple javascript:
<script type="text/javascript">
var name = new Array("cat","dog");
document.write(name[1]);
</script>
This script prints: "a" (as in the "a" from "cat"...aka name[0][1]...).
Yet when I change it to document.write(name), it prints the whole array (i.e. "cat,dog"). Why for the love of god is this simple array failing to print the entire string (which should be "dog")?!
See Question&Answers more detail:os