I have an array called NoteArray of size 16 in Javascript. I also have a static 2D array called NoteToNumberMapping of size 11x12 that [looks like this](http://www.electronics.dit.ie/staff/tscarff/Music_technology/midi/midi_note_numbers_for_octaves.htm). Now, as input, I let the user select any combination of the 12 standard notes (C-C#-D-D#-E-F-F#-G-G#-A-A#-B), or none at all. e.g. "C G G#", or "D D# G A B", or *blank* etc. PS: The notes could be "out of order" if necessary (e.g. "D A C C#")

For the "C G G#" example, I would like to refer to the 2D array and see that in octave 0, the corresponding numbers for C, G and G# are 0, 7 and 8. Likewise for octave 1, the numbers are 12, 19 and 20. Continuing in this fashion, the first 16 numbers are: 0, 7, 8, 12, 19, 20, 24, 31, 32, 36, 43, 44, 48, 55, 56, 60.

I would like to assign these 16 numbers to my initial NoteArray.

**My approach**

I implemented the 2D array as a 1D array of 128 items, containing the letters. So item 0 was C0, item 1 was C#0 all the way till item 127 (G10). I wanted to use the fact that the values in the 2D table were a linear progression from 1-127. But I ended up with 3 nested for loops and still couldn't get it to work. What would be an efficient way to achieve this in Javascript?