title: Problem with writing a proper If statement
body: <p>I have a page that passes some values using URL to input tag on another page. The problem that I have encountered was, that If there wasn't any value passed, there would be <code>undefined</code> as value, inside the input tag. So I was trying to write an if statement:</p>
  
  <pre><code>  if (params.name === undefined) {
      input.value = '';
    } else {
      input.value = params.name;
    }
    if (params.surname === undefined) {
      input.value = '';
    } else {
      input.value = params.surname;
    }
  </code></pre>
  
  <p>But as you can see based on this, it only works on, the <code>params.surname</code>, when I am passing <code>params.name</code> as a value, the input tag is clear. Any ideas how I could connect it together, so both values would show up, inside the input tag?</p>