Dev HelpersOpen library
← Back

Es9 Es2018 · code 01

Preserved from the original JavaScript Field Guide. Some entries are React fragments that require the surrounding component.

Open this example in the interactive library

Source code

const person = {
  name: 'John',
  age: 30,
};

const address = {
  city: 'New York',
  country: 'USA',
};

const merged = { ...person, ...address };
console.log(merged);
// Output: { name: 'John', age: 30, city: 'New York', country: 'USA' }

async function fetchData() {
  for await (const data of getAsyncData()) {
    console.log(data);
  }
}