← Back to challenges

Luke, I Am Your ...

JavaScriptHardconditionsformattingstringsobjects

Instructions

Luke Skywalker has family and friends. Help him remind them who is who. Given a string with a name, return the relation of that person to Luke.

PersonRelation
Darth Vaderfather
Leiasister
Hanbrother in law
R2D2droid

Examples

relationToLuke("Darth Vader") ➞ "Luke, I am your father."

relationToLuke("Leia") ➞ "Luke, I am your sister."

relationToLuke("Han") ➞ "Luke, I am your brother in law."

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Front 3 - Slice Check Repeat Concatenate