I have the following object:
{\"speed\":299,\"equipment\":49,\"teleabb\":49,\"additional\":50,\"optional\":\"299\"}
I want to sum all this
Here's a way of doing it using ES5's Object.keys and reduce:
var obj = {"speed":299,"equipment":49,"teleabb":49,"additional":50,"optional":"299"}; var sum = Object.keys(obj).reduce(function(prev, current, index) { return prev + (+obj[current]); }, 0); console.log(sum); // 746
jsFiddle