1 myFunction(); 2 function myFunction(){ 3 var person={fname:"Bill",lname:"Gates",age:56}; 4 for(var i in person){ 5 console.log(i) //获得对象中键值对的“键” 6 console.log(person[i]) //获得对象中键值对的“值” 7 } 8 }