对象

本节练习
编写程序,实现下列需求:计算下面fruit对象共有多少个水果,应该输出50。

var fruit = {
  apple: 20,
  pear: 20,
  peach: 10
};
// write your code here...
var fruit = {
  apple: 20,
  pear: 20,
  peach: 10
};
var t = fruit.apple+fruit.pear+fruit.peach; 
console.log(t);

你可能感兴趣的:(对象)