for (const propName of Object.keys(example)) {if (propName.startsWith('foo')) {console.log(`Found propName ${propName} with value ${example[propName]}`);break;}}
var example = {foo1: { /* stuff1 */},foo2: { /* stuff2 */},foo3: { /* stuff3 */}};
var keys = Object.keys(example); // => ["foo1", "foo2", "foo3"] (Note: the order here is not reliable)
var data = {"key1":"123","key2":"456"};var first = {};for(key in data){if(data.hasOwnProperty(key)){first.key = key;first.content = data[key];break;}}console.log(first); // {key:"key",content:"123"}
var object = {foo1: 'value of the first property "foo1"',foo2: { /* stuff2 */},foo3: { /* stuff3 */}};
let [firstKey] = Object.keys(object)
console.log(firstKey)console.log(object[firstKey])