KreativeMente

Untitled

Jun 12th, 2021
858
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const names = ['Peter', 'Panton', 'Mente', 'Gee'];
  2. const ages = [30, 32, 33, 40];
  3. const titles = ['Father', 'Dude', 'Friend', 'Programmer']
  4. const len = names.length;
  5. let i = 0;
  6. let result = {};
  7.  
  8. for (i; i < len; i++) {
  9.     result[names[i]] = {
  10.         age: ages[i],
  11.         title: titles[i]
  12.     }
  13. }
  14.  
  15. console.log(result)
  16.  
  17. // Expected Results
  18.  
  19. /**
  20. {
  21.     'Peter': {
  22.         'age': 30,
  23.         'title': 'Father'
  24.     },
  25.     'Panton': {
  26.         'age': 32,
  27.         'title': 'Dude'
  28.     },
  29.     'Mente': {
  30.         'age': 33,
  31.         'title': 'Friend'
  32.     },
  33.     'Gee': {
  34.         'age': 40,
  35.         'title': 'Programmer'
  36.     }
  37. }
  38. **/
RAW Paste Data