Make a Person

natnat
May 23, 2021
problem

problem explanation

In this problem

solution

we define variable fullName that holds value of person function’s firstAndLast .then in setFullName equals to function that passes argument then we return if that passes argument as first name we pass fullName that equals to that passed name plus space and plus fullName’ split by space second(1)part.if it passes argument fullName then we have to return fullName that equals to input(name).then if it passes argument lastName we have to return fullName that equals fullName’ split by space first part (0) plus space and plus name(lastName)

solution

in getFirstName we should return names first return.to do that we have to return fullName split by space’s 1 (0) part.for lastName we split it by space and return its second(1) part.in getFullName we return fullName.

that was all bye !

--

--