title: How to build a lengths converter
body: <p>I'm very new to JS and want to create a basic converter (mm, cm, dm, m, km).
  I want that if the mm input is bigger than 0, the converted cm will be entered into the cm input.
  Does anyone know what I'm doing wrong?</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 convert() {
    let milliM = parseFloat(document.getElementById("mm").value);
    let centiM = parseFloat(document.getElementById("cm").value);
    let deciM = parseFloat(document.getElementById("dm").value);
    let Meter = parseFloat(document.getElementById("m").value);
    let kiloM = parseFloat(document.getElementById("km").value);
  
    let mm = parseFloat(document.getElementById("mm"));
    let cm = parseFloat(document.getElementById("cm"));
    let dm = parseFloat(document.getElementById("dm"));
    let m = parseFloat(document.getElementById("m"));
    let km = parseFloat(document.getElementById("km"));
  
    if (milliM &gt; 0) {
      centiM = milliM / 10;
      cm.value = centiM;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;h1&gt;Converter&lt;/h1&gt;
  &lt;h2&gt;Length&lt;/h2&gt;
  &lt;div class="container"&gt;
    &lt;input type="text" id="mm" value="0"&gt; mm
    &lt;input type="text" id="cm" value="0"&gt; cm
    &lt;input type="text" id="dm" value="0"&gt; dm
    &lt;input type="text" id="m" value="0"&gt; m
    &lt;input type="text" id="km" value="0"&gt; km
    &lt;br&gt;
    &lt;button onclick="convert()"&gt;Convert&lt;/button&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>