Skip to main content
🟨 JavaScript Foundations

Objects

An object groups related values under named keys.

const user = { name: "Boots", level: 7 };
user.name; // "Boots"

When a key and the variable holding its value have the same name, you can use the shorthand { name, level } instead of { name: name, level: level }.

Your task

Write a function makeUser that takes a name and a level and returns an object with exactly those two keys: { name, level }.

⚑ 30 XP

🧱 Code blocks

Drag a block into the editor, or tap it to drop it in where your cursor is. Add them in order to build your answer.

solution.jsRuns in your browser
Loading editor…
Tests2 to pass
returns the right object
works with other values

Run your code to check these.