snapsvg

2012-07-27

Quick jQuery empty-object test

Arrays have .length but objects don't.

But since you're already using jQuery you can simply use param() to get a truthy value for the object:

  if ($.param(obj)) {
    // obj has stuff
  }

Al out.

No comments:

Post a Comment