So I want this function to accept an array of nine numbers, and I want it to return true if all the numbers are unique. I’m assuming all the numbers will be 1-9. For some reason this keeps returning false when I pass an array that should return true. You can also ignore the console log I was trying to debug with it.
You should check the incoming array is the right length. I see other people already answered your question but I didn't see anyone mention that. The way you have it now the array [1,2,3,4,5,6,7,8,9,1] would pass
4
u/Cheesybread4ever Jul 02 '21
So I want this function to accept an array of nine numbers, and I want it to return true if all the numbers are unique. I’m assuming all the numbers will be 1-9. For some reason this keeps returning false when I pass an array that should return true. You can also ignore the console log I was trying to debug with it.