title: Give empty input values a value only when they are empty/null, when a response function is executed in JavaScript
body: <p>Otherwise, I want their original value.</p>
  <p><strong>Basic desired outcome</strong>: For this example, type a name to see the result. Erase the name and I want it to say &quot;[empty]&quot; instead of the name (in the text below the field). If I type the name again it should show the name again.</p>
  <p>I am using &quot;span&quot; in a larger program so I used it in this example just in case, regardless the result should be the same.</p>
  <p>EDIT: nevermind, this is false. The result is not the same. I need it to work when &quot;span&quot; is in the declared variable.</p>
  <p>I am having a huge issue here. if/else statements are not working and I have tried all variations of ternary arguments.</p>
  <p>I got this working halfway by doing the following after declaring nameHere, however, it would not return to having the inputted name value when it was entered:</p>
  <pre><code>var empty = null;
  var nameHere = empty || &quot;[empty]&quot;;
  </code></pre>
  <p>Here is some sample code of what I have right now:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getResponse() {
    var resultValue = "Hello my name is " + nameHere + ", nice to meet you.";
    document.getElementById("result").innerHTML = resultValue;
  
    var nameHere = (nameHere === null) ? `&lt;span&gt;${"[EMPTY]"}&lt;/span&gt;` : `&lt;span&gt;${document.getElementById("name").value}&lt;/span&gt;`;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="formclass"&gt;
    &lt;label for="name"&gt;Input name here&lt;/label&gt;
    &lt;input id="name" onchange="getResponse()"&gt;&lt;/input&gt;
  &lt;/div&gt;
  
  &lt;div id="result"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>