Getter or access

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Getter
class Test {
	constructor() {
		this.stringValue = 'foo'
		this.booleanValue = this.stringValue === 'foo'
	}
}

const newTest = new Test()
console.log(newTest.booleanValue)
ready
Direct access
class Test {
	get booleanValue() {
		this.stringValue === 'foo'
	}
	constructor() {
		this.stringValue = 'foo'
	}
}

const newTest = new Test()
console.log(newTest.booleanValue)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.