Advertisement
Guest User

AssignProperties

a guest
Sep 22nd, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. function assignProperties([prop1, val1, prop2, val2, prop3, val3]){
  2. let obj = new Object();
  3. obj.prop1 = val1;
  4. obj.prop2= val2;
  5. obj.prop3 = val3;
  6. console.log(JSON.parse(`{ "${prop1}": "${obj.prop1}", "${prop2}": "${obj.prop2}", "${prop3}": "${obj.prop3}" }`));
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement