title: Implementing a Translator in JavaScript
body: <p>I am trying to write a basic JavaScript code which would act as a 'translator'. For instance certain strings in the input text-box would correspond to specific strings in the output paragraph. So, for example if the word 'x' corresponds to the word 'y', then I want a code so that whenever it finds the word 'x' in the input it will replace it with the word 'y' in the output paragraph.</p>
  
  <p><img src="https://i.stack.imgur.com/qL3Op.jpg" alt="Here for example is how it might look like."></p>
  
  <p>What would be the simplest way to implement this? And, if there happens to be a large number of translation pairs, what would be the most efficient way of listing them?</p>
  
  <p>Any guidance would be greatly appreciated.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This is how I defined the elements within the code so far:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function write_word(){
      var trans_parra = document.getElementById('trans');
      var word = document.getElementById('word');
      var eng = document.getElementById('input');}
  &lt;/script&gt;
  </code></pre>
  
  <p>And in the html body:</p>
  
  <pre><code>&lt;p align="center"&gt;&lt;input type="button" value="Search" onclick="write_word();"/&gt;
  </code></pre>
  
  <p> </p> </p></p>