return a * b; // Function returns the product of a and b. JavaScript program that returns multiple values function importantValues() { "use strict"; // Return 3 values in an array. Or, you could compress the whole function to .. The object packages all required variables. How to make one wide tileable, vertical redstone in minecraft, 9 year old is breaking the rules, and not understanding consequences, Layover/Transit in Japan Narita Airport during Covid-19, What difference does it make changing the order of arguments to 'append'. Can someone identify this school of thought? Is this possible? => JS is a callback oriented language, and there is a little secret here for "returning multiple values" that nobody has yet mentioned, try this: bam! For our purposes, a “tuple” in JavaScript will simply be an array of known length, whose values are of a known type, such as an array of three numbers: [45, 30, 90]. Different Options to return multiple values from a method in C#. Every time the interpreter meets a() it runs the function again. function num(x, y) But you can use various way to simulate returning multiple values. http://jsperf.com/returning-multiple-values-2. The function can return value to the caller by using the return statement in any programming language. So returning multiple values from a method is theoretically not possible in Java. When JavaScript reaches a return statement, the function will stop executing. @SeanKinsey I like this solution. Join Stack Overflow to learn, share knowledge, and build your career.