Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Khomenko Bohdan committed May 23, 2024
1 parent e03df78 commit 3a4b8c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/inverseRobot.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
*/

function inverseRobot(robot) {
const truePosition = {};
const invertedRobot = {};

for (const key in robot) {
if (truePosition.hasOwnProperty(robot[key])) {
if (invertedRobot.hasOwnProperty(robot[key])) {
return null;
}

truePosition[robot[key]] = key;
invertedRobot[robot[key]] = key;
}

return truePosition;
return invertedRobot;
}

module.exports = inverseRobot;

0 comments on commit 3a4b8c3

Please sign in to comment.