JavaScript | 100% Stack Reduce
\n\n\n\nconst calPoints = ops => {\n  return ops.reduce((score, op, idx) => {\n    if (op === \'C\') score.pop()\n    else if (op === \'D\') score.push(score[sc
![image](https://assets.leetcode.com/users/images/2426d8ee-2338-4056-837b-b7e4a2b61c82_1649625964.7165606.png)\n\n\n```\nconst calPoints = ops => {\n  return ops.reduce((score, op, idx) => {\n    if (op === \'C\') score.pop()\n    else if (op === \'D\') score.push(score[score.length - 1] * 2)\n    else if (op === \'+\') score.push(score[score.length - 1] + score[score.length - 2])\n    else score.push(+op)\n    return score\n  }, []).reduce((sum, num) => sum += num, 0)\n}\n```
['Stack', 'JavaScript']