Skip to content

mate-academy/js_inverse_robot

Repository files navigation

Inverse Robot

❗️❗️❗️ DON'T FORGET TO PROOFREAD YOUR CODE WITH CHECKLIST BEFORE SENDING YOUR PULL REQUEST❗️❗️❗️

Transposition of internal organs is a variant of internal anatomy, when the organs are located in a mirror image. Something similar happened to our robot Kolli. His keys became values, and values became keys. Help to repair the robot.

Task description:

Create a 'inverseRobot' function that takes 'robot' as a parameter and returns a new object in which keys will change places with values.

If any of the object values are repeated, return 'null'.

Example:

 const kolli = { Kolli: 'name', 123: 'chipVer', 3: 'wheels' };
 const robert = { Robert: 'name', 123: 'chipVer', 113: 'chipVer' };
 inverseRobot(robert) === null
 inverseRobot(kolli) === { name: 'Kolli', chipVer: '123', wheels: '3' }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published