3
// var = {hey: "baby"};
// or 
// var = $('#thingy');

if(typeof var == 'object'){  // this is true for both =(
}

I need my code to be smart enough to be able to tell the difference between these two. What's the best way to accomplish that?

hurikhan77
  • 5,881
  • 3
  • 32
  • 47
hamobi
  • 7,940
  • 4
  • 35
  • 64

1 Answers1

1

You can use the instanceof operator for this.

obj instanceof jQuery

In addition, I don't think you want to use "var" as a variable name. It's reserved to establish variable scope.

Anthony Veach
  • 320
  • 2
  • 10