🔥 Javascript Solution - Clean Code
\n/**\n * @param {number[]} tops\n * @param {number[]} bottoms\n * @return {number}\n */\nvar minDominoRotations = function(tops, bottoms) {\n    const swaps = 
```\n/**\n * @param {number[]} tops\n * @param {number[]} bottoms\n * @return {number}\n */\nvar minDominoRotations = function(tops, bottoms) {\n    const swaps = Math.min(\n        minimum(tops[0], tops, bottoms),\n        minimum(tops[0], bottoms, tops),\n        minimum(bottoms[0], tops, bottoms),\n        minimum(bottoms[0], bottoms, tops)\n    );\n\n    return swaps === Infinity ? -1 : swaps;\n\n    function minimum(target, x, y, count = 0) {\n        for(let i = 0; i < x.length; i++) {\n            if(target !== x[i]) {\n                if (target !== y[i]) return Infinity\n                count++;\n            }\n        }\n        return count;\n    }\n};\n```
['JavaScript']