How to return multiple values from a function in JavaScript ?
Usually, you return a value from a method or function in JavaScript. You can return multiple values as a JavaScript Object
.
JavaScript method returning multiple values ,
const getEmployeeInfo = () => {
return {
firstName : 'Jay',
lastName : 'Woodman'
}
}
let empName = getEmployeeInfo();
console.log(`Employee name is ${empName.firstName} ${empName.lastName}`);
// Employee name is Jay Woodman