JSFiddle - React, Tailwind, and code Playground

by luizcalaca

JavaScript

const fruits = ['banana', 'apple'];

const large = new Array(1000000000).fill('apple');

const findApple = (array) => {
	let t0 = performance.now();
   for( let i=0; i < array.length ; i++){
      if(array[i] === 'apple'){}
        console.log('Apple here!')
   }
   let t1 = performance.now()
   console.log(t1-t0 + ' milliseconds')
}

findApple(large)