javascript check if function is not defined