admin管理员组文章数量:1418352
In the same way that dojo has array functions that provide forEach and map functions to older browsers, does the Dojo Toolkit offer a solution for Object.keys and Object.values?
In the same way that dojo has array functions that provide forEach and map functions to older browsers, does the Dojo Toolkit offer a solution for Object.keys and Object.values?
Share Improve this question asked Oct 23, 2013 at 14:52 Ray WadkinsRay Wadkins 9141 gold badge7 silver badges16 bronze badges 3- possible duplicate of How can you iterate over an object (associative array) in Dojo? – Francisco Paulo Commented Oct 23, 2013 at 15:04
-
It is a possible duplicate, but that answer's link is out of date and it just covers
forIn
. This question is asking specifically aboutkeys
andvalues
. – Thomas Upton Commented Oct 23, 2013 at 19:24 - 1 Yeah, I know how to iterate over an object, that wasn't the point. – Ray Wadkins Commented Oct 25, 2013 at 3:16
1 Answer
Reset to default 8I think you might be looking for dojox/lang/functional/object
, which contains methods to get an object's keys and values. Since the documentation is pretty lacking, here's a fiddle.
require([
'dojox/lang/functional/object'
], function(o) {
var obj = {
key: 'value1',
name: 'myName',
numeric: 1,
'hello': 'there'
};
console.log(o.keys(obj));
console.log(o.values(obj));
});
There are also functions to filter
, map
, and iterate each attribute in (forEach
) objects in that module.
本文标签: javascriptDojo Equivalent for ObjectkeysStack Overflow
版权声明:本文标题:javascript - Dojo Equivalent for Object.keys - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745288821a2651667.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论