https://leetcode.com/problems/baseball-game


Runtime: 76 ms, faster than 94.44% of TypeScript online submissions for Baseball Game.
Memory Usage: 41.5 MB, less than 16.67% of TypeScript online submissions for Baseball Game.


```typescript
function calPoints(ops: string[]): number {
    //1:15
    let record_list: number[] = []
    for (const operation of ops) {
        if (operation === "C") {
            record_list.pop()
        } else if (operation === "D") {
            record_list.push(record_list[record_list.length-1]*2)
        } else if (operation === "+") {
            record_list.push(record_list[record_list.length-1] + record_list[record_list.length -2])
        } else {
            let num = Number(operation)
            record_list.push(num)
        }
    }
    let result = 0
    for (var value of record_list) {
        result += Number(value)
    }
    return result
    //1:22
    //debug until 1:31. Stupid javascript: for index in list; for value of list
};

```
