Skip to main content Accessibility Feedback

Objects

Object.entries()

Return an array of key/value pairs, also represented as arrays. Pass in the object as an argument.

var lunch = {
	sandwich: 'turkey',
	chips: 'cape cod',
	drink: 'soda'
};

// logs [['sandwich', 'turkey'], ['chips', 'cape code'], ['drink', 'soda']]
var entries = Object.entries(lunch);
console.log(entries);

Requires a polyfill for IE.