2👍
✅
It indeed only returns an empty array.
However, since arrays in JS are passed by reference, the array you get back is the very same array from within the method. So when the AJAX request resolves, the items are added to that array, which is what you subsequently see.
Source:stackexchange.com