7_loop_of_loop_of_values.js 509 B

1234567891011121314151617181920212223242526272829303132
  1. let persons = [
  2. {
  3. name: 'Sergey',
  4. surname: 'Honcharenko',
  5. age: 28,
  6. isMarried: false,
  7. },
  8. {
  9. name: 'Andrew',
  10. surname: 'Klymchuk',
  11. middleName: 'Anatoliyovych',
  12. haveAJob: true,
  13. },
  14. {
  15. name: 'Alexander',
  16. surname: 'Slobodian',
  17. sex: 'male',
  18. hasAPet: false,
  19. }
  20. ]
  21. for (let key in persons) {
  22. for (let value in persons[key]) {
  23. console.log(persons[key][value])
  24. }
  25. }
  26. // или
  27. for (let item of Object.entries(persons)) {
  28. console.log(Object.values(item[1]))
  29. }