class Class {
constructor () {
this._val = 1
}
get value() { return this._val * 2 + 1 }
set value(x) { this._val = x }
getValue() { return this._val * 2 + 1 }
setValue(x) { this.val = x }
}
var cls = new Class()
var wtf
wtf = cls.value
wtf = cls.getValue()
wtf = cls._val * 2 + 1
cls.value = 1
cls.setValue(1)
cls._val = 1
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
ES6 property (get) | |
Getter function | |
Directly get | |
ES6 property (set) | |
Setter function | |
Directly set |
This benchmark does not have any results yet. Be the first one to run it!