I am trying to filter an array where the parameters can be "true", "false", or "true || false". I am struggling to find a way to retrieve the "true || false" part. Is it feasible?
Below is the code for filtering the array:
const filtered = data.filter(entry =>
entry.brokerage == brokerage
&& entry.insurance == insurance
)
Here is my attempt to return true/false/true || false:
const brokerage = showInsurance && showBrokerage ? true || false : showBrokerage ? true : false
const insurance = showInsurance && showBrokerage ? true || false : showInsurance ? true : false
The brokerage and insurance variables will always return true and not just true or false if both showInsurance and showBrokerage are true.
I am using Vue.js for this project, but I understand that this question pertains more to JavaScript. I realize this may be an unusual inquiry, but any tips or assistance would be greatly appreciated.