you can do `player.selectedUnits = unit_list.filter(function (unit) { return Math.abs(....)...; })`