My input is the following:
Input: keys = ['username', 'first-name', 'last-name', 'age', 'username'] and  values = ['johndoe', 'John', 'Doe', 35, 'johnny']
And I want my output to look like this:
Output: {username: ['johndoe', 'johnny'], firstName: 'John', lastName: 'Doe', age: 35}
This is my code so far, which I know is not exactly solving the username having 'johndoe' and 'johnny' issue:
function mergeArrays(keys, values) {
  var obj = {};
  if (keys.length != values.length)
    return null;
  for (var index in keys)
    obj[keys[index]] = values[index];
  return obj;
} 
     
     
     
     
    