title: How do I remove all vowels from a string and return the result using a for loop?
body: <p>I want to write a function that takes in a string and returns a new string with all vowels removed using a for loop. I have tried using various string methods with no luck.</p>
  
  <p>Here's what my code looks like so far:</p>
  
  <pre><code>function disemvowel(string) {
    let newString = "";
    for (let i = 0; i &lt; str.length; i++) {
      if (string[i] != "a" &amp;&amp; string[i] != "e" &amp;&amp; string[i] != "i" &amp;&amp; string[i] != "o" &amp;&amp; string[i] != "u") {
        return newString += string[i];
      };
    };
  };
  </code></pre>
  
  <p><strong>Update</strong>
  The question was not a duplicate. Here is the solution I was looking for.</p>
  
  <pre><code>function disemvowel(string) {
  
    let vowels = {
      'a': true,
      'e': true,
      'i': true,
      'o': true,
      'u': true
    };
  
    let result = "";
  
    for (let i = 0; i &lt; string.length; i++) {
      let letter = string[i].toLowerCase();
      if (!vowels[letter]) {
        result += string[i];
      }
    };
    return result;
  };
  </code></pre>