JS 让表达式(a ==1 && a == 2 && a == 3)成立
valueOf
var a = { value: 1 , valueOf: function() { return this.value++; } }
Symbol.toPrimitive
var a = { value: 1 , get[Symbol.toPrimitive]() { return () => this.value++; } }
defineProperty
Object.defineProperty(window, 'a', { get: function(){ this.value ? this.value++ : this.value = 1; return this.value; } })
toString
var a = { value:1 ,toString: function(){ return this.value++ } }
to String & shift
var s = [1, 2, 3]; s.toString = s.shift;