Javascript function argument validation.