In the following problems, some programmer has written code and may have made mistakes in it. You should check if the code does what is described. If the code does not work correctly, you need to fix the errors.
The code should output the element of the object:
let obj = {x: 1, y: 2, z: 3};
console.log(obj[x]);
The code should output the object element by key from the variable:
let obj = {x: 1, y: 2, z: 3};
let key = 'x';
console.log(obj.key);
The code should output the sum of the object elements:
let obj = {x: 1, y: 2, z: 3};
let sum = obj[x] + obj[y] + obj[x];
console.log(obj);
The code should output the number of elements of the object:
let obj = {x: 1, y: 2, z: 3};
console.log(obj.length);