Easy JS Solution
\nvar subtractProductAndSum = function(n) {\n    let product = 1, sum = 0;\n    while (n > 0) {\n        let lastDigit = n % 10;\n        product *= lastDigit;\
```\nvar subtractProductAndSum = function(n) {\n    let product = 1, sum = 0;\n    while (n > 0) {\n        let lastDigit = n % 10;\n        product *= lastDigit;\n        sum += lastDigit;\n        n = Math.floor(n / 10);\n    }\n    return product - sum;\n};\n```
['JavaScript']