Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active August 30, 2022 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McLarenCollege/87a50fd99d39c90f2bd3268a800f30e0 to your computer and use it in GitHub Desktop.
Save McLarenCollege/87a50fd99d39c90f2bd3268a800f30e0 to your computer and use it in GitHub Desktop.
Full Name from Object

Write a function that returns the 'full name' of the given user from the userObject.

function getFullName(userObj){
// write your code here
}
let user1 = {
  age: 22,
  hasVoted: false,
  name: "vivek",
  location: "India",
  hobbies: ["dance", "music"],
  "full name": "vivek kumar",
};
let user2 = {
  age: 32,
  hasVoted: true,
  name: "Alex",
  location: "Germany",
  hobbies: ["dance", "music"],
  "full name": "Alex Smith",
};
console.log(getFullName(user1)); // "vivek kumar"
console.log(getFullName(user2)); // "Alex Smith"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment