Skip to content

Commit

Permalink
document why I'm using for instead of map, #165
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Sep 20, 2021
1 parent 93019fb commit a908c87
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/discrete/view/FourierSoundGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class FourierSoundGenerator extends SoundGenerator {
);

// {OscillatorSoundGenerator[]} Create an oscillator for each harmonic.
const oscillatorSoundGenerators = []; //REVIEW: = fourierSeries.harmonics.map( harmonic => ... )?
// Using for loop here instead of map, because we need to connect each OscillatorSoundGenerator to the
// masterGainNode, and map should not have side-effects.
const oscillatorSoundGenerators = [];
for ( let i = 0; i < fourierSeries.harmonics.length; i++ ) {
const harmonic = fourierSeries.harmonics[ i ];
const oscillatorSoundGenerator = new OscillatorSoundGenerator( {
Expand Down

0 comments on commit a908c87

Please sign in to comment.