i want to create a price calculator FORM that print total price based on price table.
but there are too many price variations.
.
as in the image checking on by one
like this:
if(type="type1" && size="22" && method="method1" && width=="150mm"){
totalPrice = 120;
}
is difficult.
is there a another way to do these kind of calculation like put data into JSON array and iterate through it to get the price.
2
Answers
Create a database object and store all the data in such a format that it can be retrieved based on the input property.
use this analogy:
This method is possible using array filter and map
save as
get-price.js
Result