Return multiple values in JavaScript?

Posted by Rohit Kumar | Updated on

In this example, I have shared return multiple values in JavaScript. Use the following JavaScript example:

Then you can access them like so:

If you want to put “labels” on each of the returned values (easier to maintain), you can return an object:

And to access them:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers