Last active
December 7, 2015 00:42
-
-
Save robmint/7d97d612c344626b2ce2 to your computer and use it in GitHub Desktop.
iterating through hash of lists in javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = { | |
subject: ['Medical Science', 'Philosophy'], | |
year: ['2015', '2013'] | |
}; | |
for (key in data) { | |
if (data.hasOwnProperty(key) && data[key] instanceof Array) { | |
list = data[key]; | |
list.forEach(function (value) { | |
console.log(key + " : " + value); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment