r/CodingHelp • • Jul 02 '21

[Javascript] Problem with JavaScript code

Post image
62 Upvotes

19 comments sorted by

View all comments

3

u/NoAd7524 Jul 02 '21

Looks like trouble with the logic of it to me. Why don't you try instead "if ... -> return true", take the else away and change the "return true" at the end for "return false" and then take it from there?

1

u/Cheesybread4ever Jul 02 '21

But I don’t want it to return true until it’s check every element of myArray. If I put return true inside the if statement it will always return true.

1

u/NoAd7524 Jul 02 '21

For uniqueness it seems like you need to check each number against the rest. Double loops, perhaps? Let's wait for the text code.