boolean vs !! (v5)

Revision 5 of this benchmark created on


Setup

let typesArray = [0, 1, '', 'qwerty', null, undefined]
// проверим оба способа на разных данных

Test runner

Ready to run.

Testing in
TestOps/sec
boolean
for (let type of typesArray) {
	if (Boolean(type)) {
		//
	}
}
ready
!!
for (let type of typesArray) {
	if (!!type) {
		//
	}
}
ready

Revisions

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