Javascript adding numbers as strings
问题 I have the following code which interprets the numbers as strings and adds them like 100300 instead of 400: var rate = document.getElementById('pur_price').value; var pprice = document.getElementById('pur_price').value; var rate1 = document.getElementById('select2').value; var refurb = 300; document.getElementById('avg_claim_rate').value=id; document.getElementById('amount_claim').value=pprice+refurb; it's the pprice and refurb field, so if pprice=100 and refurb=300, I expect it to show 400,