Answers for "can you return 2 values in javascript object"

2

can you return 2 values in javascript object

function friends(){
	var names = {
      closeCircle: ['bebo','eli','matthew'],
      outerCircle:['vierie','nate','james','george'],
    };
  	return [names.closeCircle[0], names.closeCircle[2]]
  //returns bebo and matthew
}
Posted by: Guest on October-24-2020
5

return multiple values in javascript

function getNames() {
    // get names from the database or API
    let firstName = 'John',
        lastName = 'Doe';

    // return values
    return {
        firstName,
        lastName
    };
}
Posted by: Guest on August-10-2020

Code answers related to "can you return 2 values in javascript object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language