Read the question, write TypeScript on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Build {alice: 90, bob: 85, cara: 92}. Read a name and log the score, or missing.
Input. One name.
Output. Score or missing.
Examples
Input
bob
Output
85
Input
dave
Output
missing
Hint
- scores[name] ?? 'missing'
Show correct code
Peek only after you have tried. You can still Check your own version.
const scores = { alice: 90, bob: 85, cara: 92 };
const name = readLine().trim();
console.log(scores[name] ?? 'missing');
main.tstsc · readLine() · Ctrl + Enter
ResultIdle
Run to see output. Check grades the tests.