Javascript - Practice Questions
Javascript Practice Questions
1.3
Exercise

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.

Note:

  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.