Created
April 18, 2018 08:12
-
-
Save gladchinda/d0941bdaeadefa6525cc4906aeba219f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const student = { | |
name: 'John Doe', | |
age: 16, | |
scores: { | |
maths: 74, | |
english: 63, | |
science: 85 | |
} | |
}; | |
function displaySummary(student) { | |
console.log('Hello, ' + student.name); | |
console.log('Your Maths score is ' + (student.scores.maths || 0)); | |
console.log('Your English score is ' + (student.scores.english || 0)); | |
console.log('Your Science score is ' + (student.scores.science || 0)); | |
} | |
displaySummary(student); | |
// Hello, John Doe | |
// Your Maths score is 74 | |
// Your English score is 63 | |
// Your Science score is 85 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment