JavaScript Clean Solution Beat 100%
javascript\nvar smallestRepunitDivByK = function(K) {\n    if(!(K%2) || !(K%5)) return -1; // short circuit\n    \n    let len = 0, val = 0, loop = 100000;\n   
```javascript\nvar smallestRepunitDivByK = function(K) {\n    if(!(K%2) || !(K%5)) return -1; // short circuit\n    \n    let len = 0, val = 0, loop = 100000;\n    \n    while(loop--) {\n        val = (val*10 + 1) % K; \n        len++\n        if(!val) return len;\n    }\n};\n```
['JavaScript']