-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy path7-includes.js
More file actions
26 lines (21 loc) · 460 Bytes
/
Copy path7-includes.js
File metadata and controls
26 lines (21 loc) · 460 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';
const benchmark = require('./2-benchmark.js');
const data = ['abc', 'defg', 'hijklmn', 'opqrst', 'u', 'v', 'xyz'];
function testIndexOf() {
return [
data.indexOf('opqrst') !== -1,
data.indexOf('qwerty') !== -1,
data.indexOf('v') !== -1
];
}
function testIncludes() {
return [
data.includes('opqrst'),
data.includes('qwerty'),
data.includes('v')
];
}
benchmark.do(10000000, [
testIncludes,
testIndexOf
]);