%%html
<html>
<head>
</head>
<body>
<script>
var person_one = {
name: "Yeongsu Kim",
age: 15,
classes: {1: "Honors Humanities", 2: "AP Chemistry", 3: "AP Calculus AB", 4: "AP World History", 5: "AP Computer Science Principles"},
interests: ["Music", "Video Games", "Candy", "Basketball"],
favorite_songs: ["Brahms Violin Concerto", "Tchaikovsky Violin Concerto", "Tchaikovsky Symphony no.5"],
id_num:"1951443",
num_games:5,
num_wins:2,
}
# Creates a variable object that represents a person. This is for future integrations for including users in the passion project.
console.log(person_one);
# prints original object
person_one["birthday"] = "July 23, 2008"; # creates a birthday attribute
person_one.interests.push("Computer Programming"); # adds a new interest into the interests array
person_one.favorite_songs.push("Organ Symphony"); # adds a new song to the favorite_songs array
console.log(person_one); #prints the modified object
if(person_one.num_games == 0 || person_one.num_wins == 0) # this checks if there might be an error because of the division by Zero error.
{
console.log("Win Percentage: 0%");
}
else{ #This actually calculates the win percentage based on games won and games played.
console.log("Win Percentage: " + (person_one.num_wins/person_one.num_games).toFixed(2)*100 + "%");
}
console.log(typeof person_one); #prints type of person one object
console.log(typeof person_one.name); # prints type of the name attribute
console.log(typeof person_one.age); # prints type of age attribute
console.log(typeof person_one.interests); # prints type of interests attribute
</script>
</body>
</html>