use the _.each or _.filter functions from underscore.