AscalifyCodeLibs
Back to JavaScriptJavaScript → ObjectsQuestion 1 of 4
Object Lookup
Objects
Given `scores` and `key`, print the value for that key.
Example 1:
Input: scores = { alice: 10, bob: 20, carol: 15 }, key = "bob"
Output: 20
Explanation: scores["bob"] is 20.
Example 2:
Input: scores = { alice: 10, bob: 20, carol: 15 }, key = "alice"
Output: 10
Example 3:
Input: scores = { alice: 10, bob: 20, carol: 15 }, key = "carol"
Output: 15
Code
Testcase / Output
Default testcase
key = "bob"
Expected output
20
Returned results
Click Run to execute your code against the testcase.