ToPrimitive

Obj[Symbol.toPrimitive] = function(hint) {
  // return a primitive value
  // hint = one of "string", "number", "default"
}

When an object is used in the context where a primitive is required, for instance, in an alert or mathematical operations, it's converted to a primitive value using this algorithm.

ToPrimitive — Structure map

Clickable & Draggable!

ToPrimitive — Related pages: