Object methods Flashcards

1
Q

How to create a new object method by setting object value key

A
function toObject(keyValuePair) {
  var key = keyValuePair[0];
  var value = keyValuePair[1];
  var obj = {};
  obj[key] = value;
  return obj;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly