I am having trouble calling an arguement in the functin below.
function makeScales(size,note1,note2,note3,note4,note5,note6,note7,note8){
for(var z=0; z<size; z++){
if(semis=="Sharps"){
notes = notes + " - " + noteSharp["note" + z];
} else {
notes = notes + " - " + noteFlat["note" + z];
}
}
}
I went through many debugging procedures and found that my error en-lies with noteSharp["note" + z] more specifically "note" + z . For example if i do console.log(noteSharp[note1]) i get the desired result and i set z to 7 so i can see that its populating appropriately but I get undefined for my results. Any help would be greatly appreciated.
argumentsobject by index. So startzat1, and usenoteSharp[arguments[z]]noteSharp[note1]andnoteSharp['note1']are not the same. With your function prototype, there is no nice way of accomplishing what you're trying to do.notesinitially defined? Are you aware that it's in global scope, and will also always be undefined by the end of this function assuming it wasn't defined somewhere previous? Please give some details/context.