Python Check Array Size Javascript Function Definition