ByteDance interview question

Implement 2 sum with js/ts.