Advertisement
kstoyanov

01. Phone Book jsfundamentals

Jul 9th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(args) {
  2.   const person = {};
  3.  
  4.   args.forEach((element) => {
  5.     const [name, phone] = element.split(' ');
  6.  
  7.     person[name] = phone;
  8.   });
  9.  
  10.   Object.entries(person).map((element) => {
  11.     const [name, phone] = element;
  12.  
  13.     return console.log(`${name} -> ${phone}`);
  14.   });
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement