1 Big O 26
123456789101112131415
const nemo = ['nemo'];
const largeArray = Array(1000).fill('nemo');
function findNemo(array) {
// let t0 = performance.now();
for(let i=0; i<array.length; i++) {
if(array[i]==='nemo') {
console.log('You have found Nemo!');
}
}
// let t1 = performance.now();
// console.log('Call to Nemo took ' + (t1 - t0) + ' milliseconds.');
}
findNemo(largeArray); // O(n)
JavaScript
INFO