Filtering with a variable

What would be the best way to pass a variable to a filter the hits widget with a variable?

For example, let’s say I have this variable:

var brand = "Apple";

I want to pass it to the filter bellow:

    container: '#search-results',
    templates: {
      item: `{{ symbol }}`
    hitsPerPage: 20
    filters: "brand:'brand'", // I want this 'brand' here to receive the variable value declared above.

Here’s the code on codesandbox.

Thank you so much!

This one was a newbie question and I didn’t realise I was trying to overcomplicate things.
I’ve updated the codesandbox.

var filterBrand = "samsung";
var filterString = "brand:" + filterBrand;


    filters: filterString,
1 Like