Code of the day: Javascript check if an object is empty

`isObjectEmpty()` is a function that will only return true if the passed an object that contains no keys.
This is different than jQuery.isEmptyObject() because the passed argument MUST be an object.

* Check to see if an object has any keys.
* @param {Object} obj
* @return {Boolean}
* @author Larry Battle <>
* @license WTFPL
var isObjectEmpty = function( obj ) {
	var name;
	for ( name in obj ) {
		return false;
	return obj != null && typeof obj === "object";

(Page view Count: 40)