Dynamic Object Keys

Dynamic Keys
πŸ‘¨β€πŸ’Ό Nice work! You used computed property names to create keys like "404-status".
πŸ¦‰ The key idea is a computed property name, which lets you use a variable as the key when creating the object:
const key = 'status-404'
const errorPages = {
	[key]: '/not-found',
}
This pattern is useful when a property name isn't a valid identifier.

Please set the playground first

Loading "Dynamic Object Keys"
Loading "Dynamic Object Keys"