key in object javascript for code example
Example 1: for key value in object javascript
for (const [key, value] of Object.entries(object1)) {
console.log(`${key}: ${value}`);
}
Example 2: js variable for key obj
{
[yourKeyVariable]: someValueArray,
}