JavaScript Solution
\nvar addToArrayForm = function(A, K) {\n    // i = current index of array A\n    // c = carry\n    // k = current least significant digit of K\n    // a = curr
```\nvar addToArrayForm = function(A, K) {\n    // i = current index of array A\n    // c = carry\n    // k = current least significant digit of K\n    // a = current least significant digit of A\n    // d = current digit to push\n    \n    const n = A.length\n    const temp = []\n    let i = n - 1\n    let c = 0\n    \n    while (i >= 0 || K > 0) {\n        let k = K % 10\n        let a = i < 0 ? 0 : A[i]\n        let s = k + a + c\n        let d = s % 10\n        temp.push(d)\n        c = s > 9 ? 1 : 0\n        K = Math.floor(K / 10)\n        i--\n    }\n\n    if (c == 1) temp.push(c)\n    \n    return temp.reverse()\n};\n```
['JavaScript']