0 of 8 problems solved • 0%
Use in a course

Exercise prompt

Read a Dynamic Property

Bracket notation reads a property whose name is stored in another value. Put that property-name value inside square brackets.

Example

const person = { name: "Mira", age: 20 }; const field = "name"; console.log(person[field]);

Your task

Use selectedSetting to read the matching property from settings, then display Setting: dark. Do not write .theme.

Hint

A variable holding a key needs different access from a fixed property name.