Object.entries() is a JavaScript method used to return an array of a given object’s own enumerable string-keyed property [key,value] pairs. It is useful when working with objects dynamically.
Syntax:
let customerData = {
name: ‘John Doe’,
email: ‘johndoe@example.com’,
phone: ‘123-456-7890’
};
Object.entries(customerData).forEach(([key, value]) => {
log.debug(‘Customer Data’, key + ” = “ + value);
});
The output:
name=JohnDoe
email=johndoe@example.com
phone=123-456-7890