⊗jsPmObKS 82 of 502 menu

Strings as object keys in JavaScript

Strings can be object keys:

let obj = {'a': 1, 'b': 2, 'c': 3};

In this case, it is common practice not to put the string keys in quotes:

let obj = {a: 1, b: 2, c: 3};

Let's retrieve the element of our object by key:

console.log(obj['a']); // shows 1

Create the object user with the keys 'name', 'surname', 'patronymic' and some arbitrary values. Display the last name, first name and patronymic separated by a space.

enru