Test name | Executions per second |
---|---|
not string | 1376222080.0 Ops/sec |
length is 0 | 1361458304.0 Ops/sec |
not length | 1352433536.0 Ops/sec |
string equals empty string | 1352967040.0 Ops/sec |
string soft equals empty string | 1351406464.0 Ops/sec |
not boolean | 4315719.5 Ops/sec |
length soft equals 0 | 1353920640.0 Ops/sec |
function isEmpty(string) {
return !string;
}
const text = 'This is an example of a non empty string';
const empty = '';
const test1 = isEmpty(text);
const test2 = isEmpty(empty);
function isEmpty(string) {
return string.length === 0;
}
const text = 'This is an example of a non empty string';
const empty = '';
const test1 = isEmpty(text);
const test2 = isEmpty(empty);
function isEmpty(string) {
return !string.length;
}
const text = 'This is an example of a non empty string';
const empty = '';
const test1 = isEmpty(text);
const test2 = isEmpty(empty);
function isEmpty(string) {
return string === '';
}
const text = 'This is an example of a non empty string';
const empty = '';
const test1 = isEmpty(text);
const test2 = isEmpty(empty);
function isEmpty(string) {
return string == '';
}
const text = 'This is an example of a non empty string';
const empty = '';
const test1 = isEmpty(text);
const test2 = isEmpty(empty);
function isEmpty(string) {
return !Boolean(string);
}
const text = 'This is an example of a non empty string';
const empty = '';
const test1 = isEmpty(text);
const test2 = isEmpty(empty);
function isEmpty(string) {
return string.length == 0;
}
const text = 'This is an example of a non empty string';
const empty = '';
const test1 = isEmpty(text);
const test2 = isEmpty(empty);