use native JS reduce