爲什麼輸出
的翻譯::
能有人幫幫我嗎?
當我打電話與name參數的功能搜索我 需要他給我的所有細節JavaScript對象
<script>
var friends = {};
friends.bill = {
firstName: "Bill",
lastName: "Gates",
number: "(206) 555-5555",
address: ['Microsoft Way']
};
friends.steve = {
firstName: "Steve",
lastName: "Jobes",
number: "(444) 111 000",
address: ["Apple way"]
};
var list = function(obj) {
for(var key in obj){
console.log(obj);
document.getElementById("demo").innerHTML += key + "<br>";
}
}
var search = function(name) {
for(var key in friends){
if(name === friends[key].firstName){
console.log(friends[key]);
document.getElementById('search').innerHTML += friends[key] + "<br>";
}
}
}
// list(friends);
search("Steve");
哇約翰 你是親 謝謝:) –