Hey guys I am having some difficulty in determining the error in this code. Keeps returning this error at line 22 and I'm assuming it would happen for 'couponCode' as well.
let couponArray; $w.onReady(async function () { $w("#couponsDataset").onReady(async () => { let results = await $w("#couponsDataset").getItems(0, 8); couponArray = results.items; $w('#textGroup').children.forEach((element, index) => { element.text = couponArray[index].couponName; }); }); }); function showPrize() { let prize = $w('#winningCoupon').text; let coupon = couponArray.find((element, index) => { return element.couponName === prize; }); $w('#prizeName').text = `You won: ${coupon.couponName}`; $w('#prizeName').show(); $w('#prizeCode').text = `Your Coupon Code is: ${coupon.couponCode}`; $w('#prizeCode').show(); $w('#greeting').hide(); } export function spinButton_click(event) { let spinOptions = { "duration": 1500, "delay": 1, "direction": "ccw", "cycles": 10 }; $w('#spinButton').disable(); $w('#wheelOfFortune').hide('spin', spinOptions).then(() => { $w('#wheelOfFortune').show('spin'); randomizeSpinner(couponArray); showPrize(); $w('#spinButton').enable(); }); } function randomizeSpinner(array) { let shuffledArray = shuffleArray(array); $w('#textGroup').children.forEach((element, index) => { element.text = shuffledArray[index].couponName; }); } function shuffleArray(array) { for (let last = array.length - 1; last > 0; last--) { const next = Math.floor(Math.random() * (last + 1)); // ECMAScript 2015 allows us to assign two variables at once. // We can swap the values of two variables in one line of code. [array[last], array[next]] = [array[next], array[last]]; } return array; }