Javascript - Practice Questions
Javascript Practice Questions

Get full name

Finish the function definition below.

Given an object person with keys firstName and lastName, the function getFullName should return a string which combines firstName and lastName separated by a space.


  1. If the firstName doesn’t exist, return just the lastName as the full name
  2. If the lastName doesn’t exist, return just the firstName as the full name
  3. If both firstName and lastName don’t exist, return "" as the full name.