Skip to content

Instantly share code, notes, and snippets.

@gegeke
Created June 7, 2019 14:48
Show Gist options
  • Save gegeke/c027276febf1a1c5e014cac20c3ed180 to your computer and use it in GitHub Desktop.
Save gegeke/c027276febf1a1c5e014cac20c3ed180 to your computer and use it in GitHub Desktop.
Addition benchmarking using for while
export const addSingle = (items, noItems) => {
return new Promise((resolve) => {
let sumData = 0
let i = noItems
while(i--) {
sumData += items[i].data1
}
resolve(sumData)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment