If the getOwners() call takes say 5 seconds to return, JS wont wait, and will keep executing code after it, only calling the subscribe callback once the data comes back. As I mentioned in the reply I recommend reading about how JS handles async stuff, as its key to the language.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I added an thorough answer on SO, I'll add the TLDR version here:
This code wont work as expected
it should be this:
If the
getOwners()
call takes say 5 seconds to return, JS wont wait, and will keep executing code after it, only calling thesubscribe
callback once the data comes back. As I mentioned in the reply I recommend reading about how JS handles async stuff, as its key to the language.