Javascript functions return multiple values

As the straight left

 

I’ve never really mastered Javascript, or maybe it’s constantly evolving, and there are a lot of things that seem to amaze me.

For example, if you see a Javascript statement on the web:

Return [a,b,c,d];

This is a return statement, but it has square brackets with multiple values inside.

What do you mean? Does it return multiple values? How do you extract these return values on the caller’s side?

Looking around on the Internet, I read some articles introducing Return statements, and found that they all say something very basic, and almost all of them are the same article. Others claim flatly that Javascript can never return multiple values in a function.

Return [a,b,c,d]; Statement, found no error message, so

Var re = (function f(){return [0,1,2,3]; }) ();

Then the alert (re [0]);

If 0 is displayed, the extraction succeeds.

It’s not that I don’t understand, it’s that the world is changing so fast.

—————————————————-

2020.05.13

It’s just an array, asshole.