i
Size: a a a
M
КГ
7
D

LS
LS
i
П

П

П
П
v

const obj = {
a: 1,
b: 2,
c: {
a: 4,
d: {
a: 9
}
},
f: {
h: 22
}
};
let sum = 0;
const sumAllValues = (obj) => {
Object.keys(obj).forEach(key => {
typeof obj[key] === 'object'
? sumAllValues(obj[key])
: sum = Number.isInteger(+obj[key]) && sum + obj[key]
});
}
sumAllValues(obj)
console.log(sum)VA
VA
Т
href="" target=""href=""
target=""
Z