javascript test if method exists