Hi guys
Below is a bit of code I have done within a repeater, but it returns NaN (Not a number).
Can anybody see what I am doing wrong?
Thanks :-)
export function button1_click(event, $w) { wixData.query('offers') .eq("avail", "Y") .contains('airport', $w('#airportselect').value) .contains('duration', "Daybreak") .ascending("date") .limit(100) .find() .then(res => { $w('#repeater1').data = res.items; $w('#repeater1').expand(); $w('#repeater1').show(); let adultPrice = res.items.adult; let childPrice = res.items.child; let adultCount = $w('#adultselect').value; let childCount = $w('#childselect').value; let totalPrice = ('adultPrice'*'adultCount') + ('childPrice'*'childCount'); $w('#totalPrice').text = "£" + totalPrice.toString(); }); }
Get rid of the quotes around
('adultPrice'*'adultCount') + ('childPrice'*'childCount');
Putting quotes around a var means you do not test the value, but the string itself (which is not a number)