Closed zyaffee closed 1 year ago
please add a brief summary of the solution to the thread and close it for us so we know it's all set ! 😁
solution: arrays in Javascript cannot be compared using == or ===, this operation will always return undefined. the solution is to compared the values at like indices of arrays instead.
What's the problem you're trying to solve?
Trying to assign a variable using find() but it returns undefined
Post any code you think might be relevant (one fenced block per file)
If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
no error, but there will be if this isn't defined
What is your best guess as to the source of the problem?
I am not using find correctly
What things have you already tried to solve the problem?
I've read the docs on find a couple times, I've tried explicitly returning the element with an if, I've tried several variations on the above syntax, I've tried strict and loose equality for the condition. I've console logged my outputs and the arrays that are supposed to match do seem to match, they both log as " Array [ x, y ] " in my inspector
Paste a link to your repository here
https://github.com/zyaffee/Baraka