Exercise 6 · Chapter: ObjectsRequired+50 XP
Fix the Default
This program prints undefined when you look up a name that isn't in the object. Fix it so it shows 0 for missing names instead.
Expected: if the name isn't found, print 0 as the score.
Expected output
Alice scored 95
Need a hint?
3 available · costs 5 XP each
javascript
let scores = { Alice: 95, Bob: 87 };
let name = prompt();
console.log(`${name} scored ${scores[name]}`);
Output
Run your code to see the output here.