0 Comments

Trying to work with an undefined variable?

By Kevin / Posted on 04 October 2011

I was working on the Facebook Request API and found that when I close the popup and don’t invite anyone I was getting an error that

<pre>Response was undefined</pre>

I initially tried to see if the variable was empty and that didn’t work.  I stumbled upon this gem the typeof operator and this was magic.  Now I can check to see if the response variable is an object and then run my callback function.  If it is not an object I do nothing.  Nice!

 

Categories

Facebook API, JavaScript

 
 
 

Do you have something to say?