The Key Master
Easy+20 XP
Mission Briefing
The Grand Master requires a complete inventory of all the vault's compartments! You don't need to know what's inside them, you just need a list of the compartment names themselves.
The Concept: Object Keys
The Object.keys(obj) method takes an object and returns an array containing all of the object's property names (keys) as strings.
Example: Object.keys({ a: 1, b: 2 }); // Returns ["a", "b"]
The Objective
Your function receives a data object.
- Use
Object.keys()on the object. - Return the resulting array of strings.
01EXAMPLE 1
Input
data = { a: 1, b: 2 }Output
["a", "b"]Constraints
- Use the Object.keys() method.
CoreObjects
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
data{"a":1,"b":2}
Expected Output
["a","b"]
Click RUN to test your solution