Question: Modify this function to take in an object as a parameter. The object will represent a person and have a firstName
property and a lastName
property. Return the person’s full name, separated by a space.
My solution:
function getFullName(name1, name2) {
var person = {
firstName: name1,
lastName: name2
};
return `${person.firstName} ${person.lastName}`;
}
Chrome console output:
// passing my full name with this >> getFullName(‘Souvik’, ‘Kundu’);
// output >> ‘Souvik Kundu’
I’m getting the desired output but it does not pass the test in this course. Kindly help.