title: If and Else statement are both running in javascript
body: <p>running a simple search and replace script, and i wrote an if statement that if the string <strong>AKA user input</strong> is empty, to alert "no string" but instead the else runs which is the function AND THEN the alert runs</p>
  
  <pre><code>let str = ''; // Testing if statement
  let findWord = prompt('what word do you want to find');
  let replaceWith = prompt('replace with that new word');
  
  const searchAndReplace = (string, oldWord, newWord) =&gt; {
        if (string == '') { // should it be '', or null, or undefined?
              alert('no msg')
        } else {
              return string.split(oldWord.toLowerCase()).join(newWord.toLowerCase());
        }
  }
  
  let newString = searchAndReplace(str, findWord, replaceWith);
  console.log(newString);
  </code></pre>
  
  <p>sorry in advance if this is a noob question, tried looking through here already</p>