Lets say I have values I have assigned in array in objects. I want to use reduce() to add them up. The workflow will work like this: x-data=" {package_type: [], online_implant_meeting: [], total() { return "do the math here" }} then inside x-text="total()"
I am using alpine.js to bind stuff. How do I do the calculation inside the function?
<div class="addingPrices" x-data="{package_type: [20], online_implant_meeting: [250], total(package_type, online_implant_meeting){
return package_type + online_implant_meeting;
}} >
</div>