function magicstring(str) { this.str = str; var self = this; this.addClassNames = function (classNames) { } this.removeClassNames = function (classNames) { } this.hasClassNames = function (classNames) { } } function equals(b) { var prop, otype, equal = true; for ( var i in this ) { if (a.hasOwnProperty(i)) { otype = Object.prototype.toString.call(a[prop]).match(/^\[object\s(.*)\]$/)[1]; equal = (!/^(String|Number|Window)$/.test(otype)) ? arguments.callee(a[prop], b[prop]) : (a[prop] === b[prop]); } } }