function dictionary() { /// /// 字典对象 /// } dictionary.prototype.toArray = function () { /// /// 字典扩展方法 /// /// var array = new Array(); var temp = this; temp.forIn(function (e) { array.push(temp[e]) }) return array; } dictionary.prototype.forIn = function (code) { /// /// 字典扩展方法 /// /// for (var key in this) { if (this[key].constructor.toString().indexOf("Function") > 0) continue; code(key, this[key]); } }