samedi 28 novembre 2020

How to fetch multiple key-value pairs array in Java Script/TestCafe

const passnegerGroup = [
  { FIRSTNAME: 'RAHUL', LASTNAME: 'KUMAR' },
  { FIRSTNAME: 'RINA', LASTNAME: 'KUMAR' },
  { FIRSTNAME: 'SOHAN', LASTNAME: 'SINGH' },
  { FIRSTNAME: 'PAUL', LASTNAME: 'ANDERSON' },
];

// I want to read each passenger's last name and first name and do some operations.

// Tried this code but this is

for (const key of Object.values(passnegerGroup)) {
  console.log(key.FIRSTNAME, key.LASTNAME);
}

output :

RAHUL KUMAR RINA KUMAR SOHAN SINGH PAUL ANDERSON

This is working for but getting ESLINT error. ESLint: iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.(no-restricted-syntax)

Kindly help me achieve the above using some modern JavaScript/TestCafe codes

Aucun commentaire:

Enregistrer un commentaire