I have a set of radio buttons, when a radio button is selected the element is pushed into an object. 

Then I need to take the value of the elements in the object and then push them into an array, if they are not already in the array. 

My problem is that I keep getting duplicates or more in my array of each of the values with this function because I am not checking correctly if they exists. 

How can I check if the element already exists in my array and then exclude it from being added?

```
      _this.selected = {};
      _this.selectedArray = [];

      //loop through the object
      angular.forEach(_this.selected, function ( item ){

        //if it is not the first time the array is getting data loop through the array
        if(_this.selectedArray.length > 0) {
          _this.selectedArray.forEach(function (node){

            //check to see if the item already exists-- this is where it is failing
            //and running the loop too many times 
            if(node.id !== item.id){
              _this.selectedArray.push(item);
            }
          });
        } else {
          _this.selectedArray.push(share);
        }
      });

```