Hide unselected product options

Hello, I’m trying to add the Product Configurator system from the wix examples to the site. I wrote a code so that the options I did not choose in the options will not appear on the website, so that the customers will shop according to the options I have chosen.
But when I come to the final stage of the code, the hasSome() function does not detect my code. The codes are as follows, I shared in the picture.
While my own “array” is working, the “myVariable” array I fetch from the database does not work even though it is the same.


// variable output => “Dot Pattern”,“Plus Pattern”,“Color Grid Pattern”,

    variable  =  variable . substring ( 0 ,  variable . length  -  1 ); 

let myVariable = ‘[’ + variable + ‘]’
console . log ( myVariable );
// myVariable output => [“Dot Pattern”,“Plus Pattern”,“Color Grid Pattern”]

let array = [ “Dot Pattern” , “Plus Pattern” , “Color Grid Pattern” ]
console . log ( array );

$w ( “#bodyDataset” ). setFilter ( wixData . filter ()
. eq ( ‘option’ , ‘body’ )
. hasSome ( “title” , myVariable )
);