-
Notifications
You must be signed in to change notification settings - Fork 0
Mint.utils.dictionaryForEach
Tania Shatilova edited this page Nov 10, 2015
·
1 revision
The dictionaryForEach() method executes a provided function once per dictionary element. The dictionaryForEach() method executes only for own properties of an object.
- dictionary - object that structured like a dictionary, for example, {a: 1, b: 2}.
-
callback - function to execute for each element, taking two arguments:
- key - the current element's key being processed in the dictionary, and
- value - the current element's value.
var dict = {a: 1, b: 2};
function logDictionaryElements(key, value) {
console.log("key = " + key + "; value = " + value);
}
Mint.utils.dictionaryForEach(dict, logDictionaryElements);
// logs:
// key = a; value = 1
// key = b; value = 2