I'm trying to get the following Excel sum working in Javascript.
=H21*(1+H22)*(1+H23)
H21 is a base price like 6.4 H22 and H23 are a negative percentage like '-15%'.
H22 and H23 come from range sliders so I have them like '-15'.
For now I have:
let price = H21*(1+H22)*(1+H23);
Adding % signs obviously don't work. Why does this work in Excel and not in Javascript and how can I re-factor to do this in Javascript. Any lead on documentation would also be very nice!
Why does this work in Excel and not in JavascriptThat's like saying, why do I have to change gear in a manual car, and I don't have to in an automatic. Percent, means per 100, or IOW: divide by 100.H22/100%is used for Modulo - so, the Javascript5%2is the same as the Excel=MOD(5,2), while in Excel%means "Divide by 100 and change General formatting to Percentage formatting" - so Excel2*15%is Javascript's2*15/100