[JavaScript] 1015. Smallest Integer Divisible by K
---\n\nHope it is simple to understand.\n\n---\n\n\nvar smallestRepunitDivByK = function (k) {\n    let count = 0;\n    let n = 0;\n    while (count < k) {\n   
---\n\nHope it is simple to understand.\n\n---\n\n```\nvar smallestRepunitDivByK = function (k) {\n    let count = 0;\n    let n = 0;\n    while (count < k) {\n        count++;\n        n = n * 10 + 1;              // 1, 11, 111, 1111, 11111 ..\n        n = n % k;                   // because for example 27%3 === 3%3 + 18%3\n        if (n === 0) return count;\n    }\n    return -1;\n};\n```\n\n---\n
['JavaScript']