Skip to content

Instantly share code, notes, and snippets.

@funador
Last active July 25, 2018 23:25
Show Gist options
  • Save funador/a53a1b570da5ab08b5185c8459775757 to your computer and use it in GitHub Desktop.
Save funador/a53a1b570da5ab08b5185c8459775757 to your computer and use it in GitHub Desktop.
const arrToManipulate = []
for(let i = 0; i < 50; i++) {
arrToManipulate.push(Math.ceil(Math.random() * 10))
}
// previously written atIndex function
// previously written atIndex2 function
console.time('one')
atIndex(arrToManipulate)
console.timeEnd('one') // one: 1.907ms
console.time('two')
atIndex2(arrToManipulate)
console.timeEnd('two') // two: 0.258ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment