… and equal data types?
I’ve tried a number of things and I can not get anything to work. I’m not even sure what the problem is. Is there a way to return values from a for loop?
Anyway, I did everything I want to do with this project except the next step. I have:
- an array of numbers and I have a JSON file where one of the object properties is an array of numbers.
- I was able to use an if statement to only look at the property’s value (which is an array) if it is the same length.
- I want to get only the one object that has the array that has the same numbers as my first array.
I have a CopePen of all the code except the fetch for the JSON file and a GitHub repo.
All I need to do is find the one object with the matching array then the rest is easy. If you click the submit button in CodePen I have console logs that show the array for the 6 default values in the 6 input fields.
The fields all have 0’s in them which represent the open strings on a guitar and are the notes E, A, D, G, and B (unique notes only so no 2nd E). Those notes equal an Em11 chord and the array for those notes (the “steps” away from the note E) have a corresponding record for the m11 chord in the JSON file. Here is that object:
{
"Chord": "m11",
"Intevals": ["1", "♭3", "5", "♭7", "11"],
"steps": [0, 3, 7, 10, 5],
"Equal Chords": [{"key": 10, "name": "9sus"}, {"key": 3, "name": "6 add9"}],
"Chord Substitutes": [{"key": "", "name": ""}],
"scales": {
"Major Scale": ["2nd", "3rd", "6th"],
"Minor Pentatonic": ["1st"],
"Blues Scale": ["1st"],
"Harmonic Minor": [""],
"Melodic Minor": ["2nd"],
"Whole Tone": [""],
"Augmented": [""],
"HW Diminished": [""],
"Major Bebop": ["2nd", "3rd", "6th"],
"Minor Bebop": ["2nd", "3rd", "6th"]
}
},
Does anyone know how to compare to arrays for equality?