I need convert this code to loops , but i have no idea how .
let object = { x:250 , a : 5 , b : 5 , c : {ac: 5 , acd : 10}};
let objectPropertiesSum = object => {
let sum = 0;
for (const value of Object.values(object)) {
if (typeof(value) === "number") {
sum += value;
}
else if (typeof(value) === "object") {
sum += objectPropertiesSum(value);
}
}
return sum;
};
console.log(objectPropertiesSum(object));