javascript scope test chain