Quick actions

cmd+k|ctrl+k

Navigation

Languages

findingNemo2

Snippet info

Language

JavaScript

Visibility

public

Author

99207432a

Created

2023-02-01T01:08:13.828723Z

Updated

2023-02-01T01:15:19.264313Z

//#1 -- For loop in Javascript.
const nemo = ['nemo'];

function findNemo2(array) {
  let t0 = performance.now();
  for (let i = 0; i < array.length; i++) {
    if (array[i] === 'nemo') {
      console.log('Found NEMO!');
    }
  }
  let t1 = performance.now();
  console.log('Call to find nemo took:' + (t1-t0) + 'milliseconds')
  
}

findNemo2(nemo);
INFO