Quick actions

cmd+k|ctrl+k

Navigation

Languages

Big-O - Lx1

Snippet info

Language

TypeScript

Visibility

public

Author

lilt.twirl.0

Created

2023-03-05T14:44:52.914391Z

Updated

2023-03-05T14:44:52.914391Z

const nemo = ['nemo'];

function findNemo(array) {
    let t0 = performance.now() 
    
    let i = 0 
    while (i++) {
        if (array[i] === 'nemo') {
            console.log('Found NEMO!')
            break;
        }
    }
    
    let t1 = performance.now()
    console.log('call to find Nemo took: ' + (t1-t0) + 'millionseconds')
}

findNemo(nemo);
INFO