"f() , , "
If f () returns only strings, then you should go, you just use your array as an object and add properties. The only drawback is that the array itself remains empty, so for example, you cannot calculate how many elements you have added.
If f () can return both strings and numbers, this will create a mess. A loop sometimes fills an array, sometimes an object’s properties.
I'm not sure what you mean by “like strings”, but if the result of f () is neither a number nor a string, then it will not work.
source
share