Я делаю так:
function manipulateObject(obj, func) {
return func.call(obj);
};
function func() {
Object.keys(this).reduce(function (previous, key) {
return previous + this[key].value;
}, 0);
}
console.log(manipulateObject({x: 1, y: 3, z:2}, func));
но здесь:
return previous + this[key].value;
this[key].value выдает ошибку " Cannot read property 'value' of undefined"