Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function findVal(object, key, value, upgrades) {
- Object.keys(object).forEach(function(item) {
- if (item === key && object[item] === value) {
- upgrades.push(object);
- }
- if (object[item] && typeof object[item] === 'object') {
- findVal(object[item], key, value, upgrades);
- }
- });
- return upgrades;
- }
Add Comment
Please, Sign In to add comment