Pounds-to-tons converter Finished my first lone project and I'm wondering if the execution is passable. This is a basic lbs to tons converter. The customer drives on the scale loaded, then dumps the load  and returns unloaded to the scale again. We need to convert the leftover lbs to tons. I am wondering if this is a concise way to perform this task.

loaded weight - unloaded weight = Total lbs in scrap

total lbs * 0.0005  = weight in tons



function calc() {
    let loadedAmount = document.getElementById("loaded").value;
    let unloadedAmount = document.getElementById("unloaded").value;
    let final = document.getElementById("result").value = 
Math.round(`${(loadedAmount - unloadedAmount) * 0.0005}` * 100)/100; 
    let resultInPounds = document.getElementById("result").value = 
Math.round(`${(loadedAmount - unloadedAmount)}`);

    if (!loadedAmount) {
       document.getElementById("loaded").value=alert("waiting for an initial value for loaded");
    } else {
        loadedAmount = parseInt(loadedAmount);
    }
    if (!unloadedAmount) {
        document.getElementById("unloaded").value = alert("waiting for an initial value for unloaded");
       
    } else {
        unloadedAmount = parseInt(unloadedAmount);
    }
    if (loadedAmount &lt; unloadedAmount) {
        alert("loaded amount must be greater than unloaded amount");
    } 
    console.log(`loadedAmount: ${loadedAmount}`);
    console.log(`unloadedAmount: ${unloadedAmount}`);

    document.getElementById("result").innerHTML=final + " Tons or " + 
resultInPounds + " lbs";

    console.log(result);
    
}
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt; 
    &lt;meta charset="utf-8"&gt;
&lt;title&gt;&lt;/title&gt;
&lt;style&gt;
   
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;header&gt;Negaunee Iron and Metal&lt;/header&gt;
    &lt;script src="app.js"&gt;&lt;/script&gt;
        &lt;div &gt;input loaded pounds
            &lt;input type="number"  id="loaded" placeholder="Loaded..."&gt;
        &lt;/div&gt;
        &lt;div &gt; input unloaded pounds
            &lt;input type="number" id="unloaded" placeholder="Unloaded" &gt;
        &lt;/div&gt;
        &lt;div&gt;&lt;label type="number" id="result" &gt;&lt;/label&gt;&lt;/div&gt;
        &lt;button type="submit" id="button" onclick="calc()"&gt;Click To 
Convert&lt;/button&gt;
&lt;/body&gt;
&lt;/html&gt;
The label element can be used for the labels of the input fields.

The placeholder attribute shouldn’t be used for labeling.

The output element can be used for the result. (You are using a label, which is not appropriate; and note that label can’t have a type attribute.)

Maybe a button with the button type is more appropriate here. (Button type “button” vs. “submit”)

This results in:

&lt;label for="loaded"&gt;Loaded pounds&lt;/label&gt;
&lt;input type="number" id="loaded"&gt;

&lt;label for="unloaded"&gt;Unloaded pounds&lt;/label&gt;
&lt;input type="number" id="unloaded"&gt;

&lt;button type="button" id="button" onclick="calc()"&gt;Convert&lt;/button&gt;

&lt;output for="loaded unloaded" id="result"&gt;&lt;/output&gt;