0

Question about Array destructuring

Can someone show me a good example of why we sometimes need to use a return array function instead of a normal Array for destructuring?

28th Jun 2024, 12:52 AM
Kongpheng Lo
Kongpheng Lo - avatar
3 odpowiedzi
+ 3
The reason is that the function can actually do something before it creates the array, for example it could retrieve those three values from a database.
29th Jun 2024, 7:08 PM
Tibor Santa
Tibor Santa - avatar
+ 2
What do you mean by "return array function"? Can you show the code to explain?
28th Jun 2024, 3:17 AM
Tibor Santa
Tibor Santa - avatar
28th Jun 2024, 4:04 PM
Kongpheng Lo
Kongpheng Lo - avatar