I have an object in my code, and I want to get the properties of the object, that have the name of a seperat variable.
const object = {
first: 1,
second: 2,
third: 3
};
let input = first;
let result;
setInterval(() => {
result = object.input; //Here
console.log(result);
}, 50);
On the line with the //Here, I want to get the property of the object with the name of the input. The input's value changes over time, depending on the user, that's why I can't hard code it in.
Thanks in advance.