1function sum( obj ) {
2 var sum = 0;
3 for( var el in obj ) {
4 if( obj.hasOwnProperty( el ) ) {
5 sum += parseFloat( obj[el] );
6 }
7 }
8 return sum;
9}
10
11var sample = { a: 1 , b: 2 , c:3 };
12var summed = sum( sample );
13console.log( "sum: "+summed );