function*objectEntries(obj) {constpropKeys=Reflect.ownKeys(obj);for (constpropKeyof propKeys) {// `yield` returns a value and then pauses// the generator. Later, execution continues// where it was previously paused.yield [propKey, obj[propKey]]; }}constjane= { first:"Jane", last:"Doe" };for (const [key,value] ofobjectEntries(jane)) {console.log(`${key}: ${value}`);}