Hacker News new | ask | show | jobs
by tomcam 1604 days ago
What is the … operator for?

    test.use({
      ...devices['iPhone 13 Pro'],
      locale: 'en-US',
      geolocation: { longitude: 12.492507, latitude: 41.889938 },
      permissions: ['geolocation'],
    })
1 comments

That is the JavaScript spread operator. It takes all of the elements of an object or an array and adds them to another. In this case, the code posted is merging the iphone 13 pro device settings object into an object literal
Most cool, thx