Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Invert Keys

function invert(obj) {
  var result = {};
  var _keys = keys(obj);
  for (var i = 0, length = _keys.length; i < length; i++) {
    result[obj[_keys[i]]] = _keys[i];
  }
  return result;
}
Source by underscorejs.org #
 
PREVIOUS NEXT
Tagged: #Invert #Keys
ADD COMMENT
Topic
Name
1+8 =