How to Return Multiple Values from a Function in JavaScript
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Return an
Array
of ValuesA function cannot return multiple values. However, you can get the similar results by returning an array containing multiple values. Let's take a look at the following example:
Alternatively, you can also return an object if you want to label each of the returned values for easier access and maintenance, as demonstrated in the following example:
need an explanation for this answer? contact us directly to get an explanation for this answer