// With new JavaScript syntax, you can do this easily!
function returnsMultiple(){
return ["foo", "bar"];
}
let [firstValue, secondValue] = returnsMultiple();
function getNames() {
// get names from the database or API
let firstName = 'John',
lastName = 'Doe';
// return as an array
return [firstName, lastName];
}
Code language: JavaScript (javascript)