Skip to content

Instantly share code, notes, and snippets.

@jasonleehodges
Last active September 14, 2020 17:30
Show Gist options
  • Save jasonleehodges/149c6a3a76458db1657eb4819b6b42c3 to your computer and use it in GitHub Desktop.
Save jasonleehodges/149c6a3a76458db1657eb4819b6b42c3 to your computer and use it in GitHub Desktop.
Figure 1 - Basic Accumulator Pattern
const numbers: number[] = [3, 5, 7, 9, 12];
let accumulator: number = 0;
for (let i = 0; i < numbers.length; i++) {
accumulator += numbers[i];
}
// 36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment