diff --git a/src/inverseRobot.js b/src/inverseRobot.js index 4906e020..abef73e9 100644 --- a/src/inverseRobot.js +++ b/src/inverseRobot.js @@ -7,7 +7,19 @@ */ function inverseRobot(robot) { - // write code here + const result = {}; + + for (const key in robot) { + const resultKey = robot[key]; + + if (result.hasOwnProperty(resultKey)) { + return null; + } + + result[resultKey] = key; + } + + return result; } module.exports = inverseRobot;