Handle cases where a function is called on an empty array

1. Check for contents of an array before invoking the dot call
2. Basic language test