<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<button type="button" onclick="contact_list()">Call Contact List!</button>
<br>
<div id="result"></div>
</body>
</html>
// Code goes here
function contact_list(){
var friends = {};
friends.bill = {
firstName : "Bill",
lastName : "Gates",
number : "(206) 555-5555",
address : ['one Microsoft Way' , 'Redmond', 'WA', '98052']
}
friends.steve = {
firstName : "Steve",
lastName : "gate",
number : "0875067560",
address : ['maama' , 'haaha','blala']
}
var txt ="";
var list = function(obj){
for(var key in obj){
txt = txt + "<br>" + key ;
}
};
var search = function(name){
for(var key in friends){
if(friends[key].firstName === name){
console.log(friends[key]);
return friends[key];
}
}
}
list(friends);
var rx = JSON.stringify(search("Steve"));
document.getElementById('result').innerHTML = txt + "<br>" + rx ;
}
/* Styles go here */