title: Compare value from array of objects to string in React Native/Javascript
body: <p>I'm trying to use an If statement to compare a property off of an object in an array to a String. I'm using a for-loop but for some reason, I cannot seem to trigger the conditional statement. This is the code I'm using to store the object in AsyncStorage:</p>
  
  <pre><code>onPressNext= async () =&gt; {
          if (this.state.selectedFrequency.length &gt; 0) {
              const selectedFrequency = this.state.selectedFrequency;
              try {
                  await AsyncStorage.setItem('selectedFrequency', JSON.stringify(selectedFrequency));
                } catch (error) {
                  // Error saving data
                }
  </code></pre>
  
  <p>and this is the code I'm using to retrieve the object later:</p>
  
  <pre><code>onPressNext= async () =&gt; {
  
          if (this.state.selectedExclusions.length &gt; 0) {
              try {
                  const value = await AsyncStorage.getItem('selectedFrequency');
                  if (value !== null) {
                    console.log(JSON.parse(value));
                    const selectedFrequency = JSON.parse(value);
  
                    for (let j = 0; j &lt; selectedFrequency.length; j++) {
                      if (JSON.stringify(selectedFrequency[j].value) === 'Daily') {
                          selectedFrequency[j].splice(j, 1);
                       } else {
                          console.log(JSON.stringify(selectedFrequency[j].label));
                       }   
                   }
                  }
                } catch (error) {
                  // Error retrieving data
                  Alert.alert(
                      error,
                      'Sorry, there was an error',
                      [
                        { text: strings.Okay, style: 'cancel' },
                      ]
                  );
                }
  </code></pre>
  
  <p>and this is how the aray is structured: </p>
  
  <pre><code>frequency = [
      { label: strings.Daily, value: 'Daily' },
      { label: strings.Weekly, value: 'Weekly' },
      { label: strings.Monthly, value: 'Monthly' },
      { label: strings.Every_Three_Months, value: '3 Months' },
      { label: strings.three_five_Years, value: '5 Years' },
      { label: strings.Ten_Years, value: '10 Years' }
  ]; 
  </code></pre>
  
  <p>What I'm expecting to happen is that if the array of objects contains an item with the string value of Daily, then that item will be removed. So the for loop goes through the array, checks the values and removes any object with the value of Daily. As mentioned below I think that the problem lies within the If statement found in the for loop.</p>
  
  <p>Any help would be greatly appreciated! </p>