3 Line Solution - TypeScript & JavaScript
\n# TypeScript Code\n\nfunction subtractProductAndSum(n: number): number {\n    let sum : number =n.toString().split(\'\').map(str => parseFloat(str)).reduce((a
\n# TypeScript Code\n```\nfunction subtractProductAndSum(n: number): number {\n    let sum : number =n.toString().split(\'\').map(str => parseFloat(str)).reduce((acc,curr) => acc + curr , 0)\n    let mul : number =n.toString().split(\'\').map(str => parseFloat(str)).reduce((acc,curr) => acc * curr , 1)\n    return mul - sum\n};\n```\n\n# JavaScript Code\n```\nfunction subtractProductAndSum(n){\n    let sum = n.toString().split(\'\').map(str => parseFloat(str)).reduce((acc,curr) => acc + curr , 0)\n    let mul = n.toString().split(\'\').map(str => parseFloat(str)).reduce((acc,curr) => acc * curr , 1)\n    return mul - sum\n};\n```
['TypeScript', 'JavaScript']