Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default function (data) {
- // your code starts here
- let result = {};
- let keys = data['keys'];
- let objOne = data['first'];
- let objTwo = data['second'];
- for (let key of keys){
- let tempArray = [];
- if(objOne.hasOwnProperty(key) && objTwo.hasOwnProperty(key)){
- tempArray.push(objOne[key]);
- tempArray.push(objTwo[key]);
- result[key] = tempArray
- } else if (objOne.hasOwnProperty(key)){
- result[key] = objOne[key]
- } else if (objTwo.hasOwnProperty(key)){
- result[key] = objTwo[key]
- } else {
- result[key] = null;
- }
- }
- return result;
- // your code ends here
- }
Advertisement
Add Comment
Please, Sign In to add comment