Simple JS solution
js\nvar calPoints = function(ops) {\n    const arr = []\n    const actions = {\n        C: () => arr.pop(),\n        D: () => arr.push(arr[arr.length - 1] * 2),
```js\nvar calPoints = function(ops) {\n    const arr = []\n    const actions = {\n        C: () => arr.pop(),\n        D: () => arr.push(arr[arr.length - 1] * 2),\n        '+': () => arr.push(arr[arr.length - 1] + arr[arr.length - 2])\n    }\n    for (let a of ops) {\n        a in actions ? actions[a](): arr.push(+a)\n    }\n    return arr.reduce((sum, num) => sum + num)\n};\n```
[]